##// END OF EJS Templates
code layout clean up issues_helper_test.rb...
Toshi MARUYAMA -
r11483:c745acf4c230
parent child
Show More
@@ -45,60 +45,67 class IssuesHelperTest < ActionView::TestCase
45 end
45 end
46
46
47 def test_issues_destroy_confirmation_message_with_one_root_issue
47 def test_issues_destroy_confirmation_message_with_one_root_issue
48 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find(1))
48 assert_equal l(:text_issues_destroy_confirmation),
49 issues_destroy_confirmation_message(Issue.find(1))
49 end
50 end
50
51
51 def test_issues_destroy_confirmation_message_with_an_arrayt_of_root_issues
52 def test_issues_destroy_confirmation_message_with_an_arrayt_of_root_issues
52 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2]))
53 assert_equal l(:text_issues_destroy_confirmation),
54 issues_destroy_confirmation_message(Issue.find([1, 2]))
53 end
55 end
54
56
55 def test_issues_destroy_confirmation_message_with_one_parent_issue
57 def test_issues_destroy_confirmation_message_with_one_parent_issue
56 Issue.find(2).update_attribute :parent_issue_id, 1
58 Issue.find(2).update_attribute :parent_issue_id, 1
57 assert_equal l(:text_issues_destroy_confirmation) + "\n" + l(:text_issues_destroy_descendants_confirmation, :count => 1),
59 assert_equal l(:text_issues_destroy_confirmation) + "\n" +
58 issues_destroy_confirmation_message(Issue.find(1))
60 l(:text_issues_destroy_descendants_confirmation, :count => 1),
61 issues_destroy_confirmation_message(Issue.find(1))
59 end
62 end
60
63
61 def test_issues_destroy_confirmation_message_with_one_parent_issue_and_its_child
64 def test_issues_destroy_confirmation_message_with_one_parent_issue_and_its_child
62 Issue.find(2).update_attribute :parent_issue_id, 1
65 Issue.find(2).update_attribute :parent_issue_id, 1
63 assert_equal l(:text_issues_destroy_confirmation), issues_destroy_confirmation_message(Issue.find([1, 2]))
66 assert_equal l(:text_issues_destroy_confirmation),
67 issues_destroy_confirmation_message(Issue.find([1, 2]))
64 end
68 end
65
69
66 test 'IssuesHelper#show_detail with no_html should show a changing attribute' do
70 test 'IssuesHelper#show_detail with no_html should show a changing attribute' do
67 detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
71 detail = JournalDetail.new(:property => 'attr', :old_value => '40',
72 :value => '100', :prop_key => 'done_ratio')
68 assert_equal "% Done changed from 40 to 100", show_detail(detail, true)
73 assert_equal "% Done changed from 40 to 100", show_detail(detail, true)
69 end
74 end
70
75
71 test 'IssuesHelper#show_detail with no_html should show a new attribute' do
76 test 'IssuesHelper#show_detail with no_html should show a new attribute' do
72 detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
77 detail = JournalDetail.new(:property => 'attr', :old_value => nil,
78 :value => '100', :prop_key => 'done_ratio')
73 assert_equal "% Done set to 100", show_detail(detail, true)
79 assert_equal "% Done set to 100", show_detail(detail, true)
74 end
80 end
75
81
76 test 'IssuesHelper#show_detail with no_html should show a deleted attribute' do
82 test 'IssuesHelper#show_detail with no_html should show a deleted attribute' do
77 detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
83 detail = JournalDetail.new(:property => 'attr', :old_value => '50',
84 :value => nil, :prop_key => 'done_ratio')
78 assert_equal "% Done deleted (50)", show_detail(detail, true)
85 assert_equal "% Done deleted (50)", show_detail(detail, true)
79 end
86 end
80
87
81 test 'IssuesHelper#show_detail with html should show a changing attribute with HTML highlights' do
88 test 'IssuesHelper#show_detail with html should show a changing attribute with HTML highlights' do
82 detail = JournalDetail.new(:property => 'attr', :old_value => '40', :value => '100', :prop_key => 'done_ratio')
89 detail = JournalDetail.new(:property => 'attr', :old_value => '40',
90 :value => '100', :prop_key => 'done_ratio')
83 html = show_detail(detail, false)
91 html = show_detail(detail, false)
84
85 assert_include '<strong>% Done</strong>', html
92 assert_include '<strong>% Done</strong>', html
86 assert_include '<i>40</i>', html
93 assert_include '<i>40</i>', html
87 assert_include '<i>100</i>', html
94 assert_include '<i>100</i>', html
88 end
95 end
89
96
90 test 'IssuesHelper#show_detail with html should show a new attribute with HTML highlights' do
97 test 'IssuesHelper#show_detail with html should show a new attribute with HTML highlights' do
91 detail = JournalDetail.new(:property => 'attr', :old_value => nil, :value => '100', :prop_key => 'done_ratio')
98 detail = JournalDetail.new(:property => 'attr', :old_value => nil,
99 :value => '100', :prop_key => 'done_ratio')
92 html = show_detail(detail, false)
100 html = show_detail(detail, false)
93
94 assert_include '<strong>% Done</strong>', html
101 assert_include '<strong>% Done</strong>', html
95 assert_include '<i>100</i>', html
102 assert_include '<i>100</i>', html
96 end
103 end
97
104
98 test 'IssuesHelper#show_detail with html should show a deleted attribute with HTML highlights' do
105 test 'IssuesHelper#show_detail with html should show a deleted attribute with HTML highlights' do
99 detail = JournalDetail.new(:property => 'attr', :old_value => '50', :value => nil, :prop_key => 'done_ratio')
106 detail = JournalDetail.new(:property => 'attr', :old_value => '50',
107 :value => nil, :prop_key => 'done_ratio')
100 html = show_detail(detail, false)
108 html = show_detail(detail, false)
101
102 assert_include '<strong>% Done</strong>', html
109 assert_include '<strong>% Done</strong>', html
103 assert_include '<del><i>50</i></del>', html
110 assert_include '<del><i>50</i></del>', html
104 end
111 end
@@ -130,65 +137,76 class IssuesHelperTest < ActionView::TestCase
130 end
137 end
131
138
132 test 'IssuesHelper#show_detail should show old and new values with a project attribute' do
139 test 'IssuesHelper#show_detail should show old and new values with a project attribute' do
133 detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id', :old_value => 1, :value => 2)
140 detail = JournalDetail.new(:property => 'attr', :prop_key => 'project_id',
141 :old_value => 1, :value => 2)
134 assert_match 'eCookbook', show_detail(detail, true)
142 assert_match 'eCookbook', show_detail(detail, true)
135 assert_match 'OnlineStore', show_detail(detail, true)
143 assert_match 'OnlineStore', show_detail(detail, true)
136 end
144 end
137
145
138 test 'IssuesHelper#show_detail should show old and new values with a issue status attribute' do
146 test 'IssuesHelper#show_detail should show old and new values with a issue status attribute' do
139 detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id', :old_value => 1, :value => 2)
147 detail = JournalDetail.new(:property => 'attr', :prop_key => 'status_id',
148 :old_value => 1, :value => 2)
140 assert_match 'New', show_detail(detail, true)
149 assert_match 'New', show_detail(detail, true)
141 assert_match 'Assigned', show_detail(detail, true)
150 assert_match 'Assigned', show_detail(detail, true)
142 end
151 end
143
152
144 test 'IssuesHelper#show_detail should show old and new values with a tracker attribute' do
153 test 'IssuesHelper#show_detail should show old and new values with a tracker attribute' do
145 detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id', :old_value => 1, :value => 2)
154 detail = JournalDetail.new(:property => 'attr', :prop_key => 'tracker_id',
155 :old_value => 1, :value => 2)
146 assert_match 'Bug', show_detail(detail, true)
156 assert_match 'Bug', show_detail(detail, true)
147 assert_match 'Feature request', show_detail(detail, true)
157 assert_match 'Feature request', show_detail(detail, true)
148 end
158 end
149
159
150 test 'IssuesHelper#show_detail should show old and new values with a assigned to attribute' do
160 test 'IssuesHelper#show_detail should show old and new values with a assigned to attribute' do
151 detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id', :old_value => 1, :value => 2)
161 detail = JournalDetail.new(:property => 'attr', :prop_key => 'assigned_to_id',
162 :old_value => 1, :value => 2)
152 assert_match 'Redmine Admin', show_detail(detail, true)
163 assert_match 'Redmine Admin', show_detail(detail, true)
153 assert_match 'John Smith', show_detail(detail, true)
164 assert_match 'John Smith', show_detail(detail, true)
154 end
165 end
155
166
156 test 'IssuesHelper#show_detail should show old and new values with a priority attribute' do
167 test 'IssuesHelper#show_detail should show old and new values with a priority attribute' do
157 detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id', :old_value => 4, :value => 5)
168 detail = JournalDetail.new(:property => 'attr', :prop_key => 'priority_id',
169 :old_value => 4, :value => 5)
158 assert_match 'Low', show_detail(detail, true)
170 assert_match 'Low', show_detail(detail, true)
159 assert_match 'Normal', show_detail(detail, true)
171 assert_match 'Normal', show_detail(detail, true)
160 end
172 end
161
173
162 test 'IssuesHelper#show_detail should show old and new values with a category attribute' do
174 test 'IssuesHelper#show_detail should show old and new values with a category attribute' do
163 detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id', :old_value => 1, :value => 2)
175 detail = JournalDetail.new(:property => 'attr', :prop_key => 'category_id',
176 :old_value => 1, :value => 2)
164 assert_match 'Printing', show_detail(detail, true)
177 assert_match 'Printing', show_detail(detail, true)
165 assert_match 'Recipes', show_detail(detail, true)
178 assert_match 'Recipes', show_detail(detail, true)
166 end
179 end
167
180
168 test 'IssuesHelper#show_detail should show old and new values with a fixed version attribute' do
181 test 'IssuesHelper#show_detail should show old and new values with a fixed version attribute' do
169 detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id', :old_value => 1, :value => 2)
182 detail = JournalDetail.new(:property => 'attr', :prop_key => 'fixed_version_id',
183 :old_value => 1, :value => 2)
170 assert_match '0.1', show_detail(detail, true)
184 assert_match '0.1', show_detail(detail, true)
171 assert_match '1.0', show_detail(detail, true)
185 assert_match '1.0', show_detail(detail, true)
172 end
186 end
173
187
174 test 'IssuesHelper#show_detail should show old and new values with a estimated hours attribute' do
188 test 'IssuesHelper#show_detail should show old and new values with a estimated hours attribute' do
175 detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours', :old_value => '5', :value => '6.3')
189 detail = JournalDetail.new(:property => 'attr', :prop_key => 'estimated_hours',
190 :old_value => '5', :value => '6.3')
176 assert_match '5.00', show_detail(detail, true)
191 assert_match '5.00', show_detail(detail, true)
177 assert_match '6.30', show_detail(detail, true)
192 assert_match '6.30', show_detail(detail, true)
178 end
193 end
179
194
180 test 'IssuesHelper#show_detail should show old and new values with a custom field' do
195 test 'IssuesHelper#show_detail should show old and new values with a custom field' do
181 detail = JournalDetail.new(:property => 'cf', :prop_key => '1', :old_value => 'MySQL', :value => 'PostgreSQL')
196 detail = JournalDetail.new(:property => 'cf', :prop_key => '1',
197 :old_value => 'MySQL', :value => 'PostgreSQL')
182 assert_equal 'Database changed from MySQL to PostgreSQL', show_detail(detail, true)
198 assert_equal 'Database changed from MySQL to PostgreSQL', show_detail(detail, true)
183 end
199 end
184
200
185 test 'IssuesHelper#show_detail should show added file' do
201 test 'IssuesHelper#show_detail should show added file' do
186 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => nil, :value => 'error281.txt')
202 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1',
203 :old_value => nil, :value => 'error281.txt')
187 assert_match 'error281.txt', show_detail(detail, true)
204 assert_match 'error281.txt', show_detail(detail, true)
188 end
205 end
189
206
190 test 'IssuesHelper#show_detail should show removed file' do
207 test 'IssuesHelper#show_detail should show removed file' do
191 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1', :old_value => 'error281.txt', :value => nil)
208 detail = JournalDetail.new(:property => 'attachment', :prop_key => '1',
209 :old_value => 'error281.txt', :value => nil)
192 assert_match 'error281.txt', show_detail(detail, true)
210 assert_match 'error281.txt', show_detail(detail, true)
193 end
211 end
194 end
212 end
General Comments 0
You need to be logged in to leave comments. Login now