@@ -270,7 +270,7 private | |||
|
270 | 270 | @edit_allowed = User.current.allowed_to?(:edit_issues, @project) |
|
271 | 271 | @time_entry = TimeEntry.new |
|
272 | 272 | |
|
273 | @notes = params[:notes] | |
|
273 | @notes = params[:notes] || (params[:issue].present? ? params[:issue][:notes] : nil) | |
|
274 | 274 | @issue.init_journal(User.current, @notes) |
|
275 | 275 | # User can change issue attributes only if he has :edit permission or if a workflow transition is allowed |
|
276 | 276 | if (@edit_allowed || !@allowed_statuses.empty?) && params[:issue] |
@@ -198,7 +198,7 class IssuesApiTest < ActionController::IntegrationTest | |||
|
198 | 198 | setup do |
|
199 | 199 | @issue_count = Issue.count |
|
200 | 200 | @journal_count = Journal.count |
|
201 | @attributes = {:subject => 'API update'} | |
|
201 | @attributes = {:subject => 'API update', :notes => 'A new note'} | |
|
202 | 202 | |
|
203 | 203 | put '/issues/1.xml', {:issue => @attributes}, :authorization => credentials('jsmith') |
|
204 | 204 | end |
@@ -214,10 +214,15 class IssuesApiTest < ActionController::IntegrationTest | |||
|
214 | 214 | assert_equal Journal.count, @journal_count + 1 |
|
215 | 215 | end |
|
216 | 216 | |
|
217 | should "add the note to the journal" do | |
|
218 | journal = Journal.last | |
|
219 | assert_equal "A new note", journal.notes | |
|
220 | end | |
|
221 | ||
|
217 | 222 | should "update the issue" do |
|
218 | 223 | issue = Issue.find(1) |
|
219 | 224 | @attributes.each do |attribute, value| |
|
220 | assert_equal value, issue.send(attribute) | |
|
225 | assert_equal value, issue.send(attribute) unless attribute == :notes | |
|
221 | 226 | end |
|
222 | 227 | end |
|
223 | 228 | |
@@ -252,7 +257,7 class IssuesApiTest < ActionController::IntegrationTest | |||
|
252 | 257 | setup do |
|
253 | 258 | @issue_count = Issue.count |
|
254 | 259 | @journal_count = Journal.count |
|
255 | @attributes = {:subject => 'API update'} | |
|
260 | @attributes = {:subject => 'API update', :notes => 'A new note'} | |
|
256 | 261 | |
|
257 | 262 | put '/issues/1.json', {:issue => @attributes}, :authorization => credentials('jsmith') |
|
258 | 263 | end |
@@ -268,13 +273,18 class IssuesApiTest < ActionController::IntegrationTest | |||
|
268 | 273 | assert_equal Journal.count, @journal_count + 1 |
|
269 | 274 | end |
|
270 | 275 | |
|
276 | should "add the note to the journal" do | |
|
277 | journal = Journal.last | |
|
278 | assert_equal "A new note", journal.notes | |
|
279 | end | |
|
280 | ||
|
271 | 281 | should "update the issue" do |
|
272 | 282 | issue = Issue.find(1) |
|
273 | 283 | @attributes.each do |attribute, value| |
|
274 | assert_equal value, issue.send(attribute) | |
|
284 | assert_equal value, issue.send(attribute) unless attribute == :notes | |
|
275 | 285 | end |
|
276 | 286 | end |
|
277 | ||
|
287 | ||
|
278 | 288 | end |
|
279 | 289 | |
|
280 | 290 | context "PUT /issues/1.json with failed update" do |
General Comments 0
You need to be logged in to leave comments.
Login now