##// END OF EJS Templates
remove unneeded 'redmine/field_format' requirement from FieldFormatTest...
Toshi MARUYAMA -
r12187:e9a48cf86a69
parent child
Show More
@@ -1,55 +1,54
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
2 # Copyright (C) 2006-2013 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../../../../test_helper', __FILE__)
18 require File.expand_path('../../../../../test_helper', __FILE__)
19 require 'redmine/field_format'
20
19
21 class Redmine::FieldFormatTest < ActionView::TestCase
20 class Redmine::FieldFormatTest < ActionView::TestCase
22 include ApplicationHelper
21 include ApplicationHelper
23
22
24 def test_string_field_with_text_formatting_disabled_should_not_format_text
23 def test_string_field_with_text_formatting_disabled_should_not_format_text
25 field = IssueCustomField.new(:field_format => 'string')
24 field = IssueCustomField.new(:field_format => 'string')
26 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*")
25 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*")
27
26
28 assert_equal "*foo*", field.format.formatted_custom_value(self, custom_value, false)
27 assert_equal "*foo*", field.format.formatted_custom_value(self, custom_value, false)
29 assert_equal "*foo*", field.format.formatted_custom_value(self, custom_value, true)
28 assert_equal "*foo*", field.format.formatted_custom_value(self, custom_value, true)
30 end
29 end
31
30
32 def test_string_field_with_text_formatting_enabled_should_format_text
31 def test_string_field_with_text_formatting_enabled_should_format_text
33 field = IssueCustomField.new(:field_format => 'string', :text_formatting => 'full')
32 field = IssueCustomField.new(:field_format => 'string', :text_formatting => 'full')
34 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*")
33 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*")
35
34
36 assert_equal "*foo*", field.format.formatted_custom_value(self, custom_value, false)
35 assert_equal "*foo*", field.format.formatted_custom_value(self, custom_value, false)
37 assert_include "<strong>foo</strong>", field.format.formatted_custom_value(self, custom_value, true)
36 assert_include "<strong>foo</strong>", field.format.formatted_custom_value(self, custom_value, true)
38 end
37 end
39
38
40 def test_text_field_with_text_formatting_disabled_should_not_format_text
39 def test_text_field_with_text_formatting_disabled_should_not_format_text
41 field = IssueCustomField.new(:field_format => 'text')
40 field = IssueCustomField.new(:field_format => 'text')
42 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*\nbar")
41 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*\nbar")
43
42
44 assert_equal "*foo*\nbar", field.format.formatted_custom_value(self, custom_value, false)
43 assert_equal "*foo*\nbar", field.format.formatted_custom_value(self, custom_value, false)
45 assert_include "*foo*\n<br />bar", field.format.formatted_custom_value(self, custom_value, true)
44 assert_include "*foo*\n<br />bar", field.format.formatted_custom_value(self, custom_value, true)
46 end
45 end
47
46
48 def test_text_field_with_text_formatting_enabled_should_format_text
47 def test_text_field_with_text_formatting_enabled_should_format_text
49 field = IssueCustomField.new(:field_format => 'text', :text_formatting => 'full')
48 field = IssueCustomField.new(:field_format => 'text', :text_formatting => 'full')
50 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*\nbar")
49 custom_value = CustomValue.new(:custom_field => field, :customized => Issue.new, :value => "*foo*\nbar")
51
50
52 assert_equal "*foo*\nbar", field.format.formatted_custom_value(self, custom_value, false)
51 assert_equal "*foo*\nbar", field.format.formatted_custom_value(self, custom_value, false)
53 assert_include "<strong>foo</strong>", field.format.formatted_custom_value(self, custom_value, true)
52 assert_include "<strong>foo</strong>", field.format.formatted_custom_value(self, custom_value, true)
54 end
53 end
55 end
54 end
General Comments 0
You need to be logged in to leave comments. Login now