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