@@ -233,7 +233,7 class Issue < ActiveRecord::Base | |||||
233 | # Copies attributes from another issue, arg can be an id or an Issue |
|
233 | # Copies attributes from another issue, arg can be an id or an Issue | |
234 | def copy_from(arg, options={}) |
|
234 | def copy_from(arg, options={}) | |
235 | issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg) |
|
235 | issue = arg.is_a?(Issue) ? arg : Issue.visible.find(arg) | |
236 | self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on") |
|
236 | self.attributes = issue.attributes.dup.except("id", "root_id", "parent_id", "lft", "rgt", "created_on", "updated_on", "closed_on") | |
237 | self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h} |
|
237 | self.custom_field_values = issue.custom_field_values.inject({}) {|h,v| h[v.custom_field_id] = v.value; h} | |
238 | self.status = issue.status |
|
238 | self.status = issue.status | |
239 | self.author = User.current |
|
239 | self.author = User.current |
@@ -1268,6 +1268,16 class IssueTest < ActiveSupport::TestCase | |||||
1268 | end |
|
1268 | end | |
1269 | end |
|
1269 | end | |
1270 |
|
1270 | |||
|
1271 | def test_copy_should_clear_closed_on | |||
|
1272 | copied_open = Issue.find(8).copy(:status_id => 1) | |||
|
1273 | assert copied_open.save | |||
|
1274 | assert_nil copied_open.closed_on | |||
|
1275 | ||||
|
1276 | copied_closed = Issue.find(8).copy | |||
|
1277 | assert copied_closed.save | |||
|
1278 | assert_not_nil copied_closed.closed_on | |||
|
1279 | end | |||
|
1280 | ||||
1271 | def test_should_not_call_after_project_change_on_creation |
|
1281 | def test_should_not_call_after_project_change_on_creation | |
1272 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, |
|
1282 | issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1, | |
1273 | :subject => 'Test', :author_id => 1) |
|
1283 | :subject => 'Test', :author_id => 1) |
General Comments 0
You need to be logged in to leave comments.
Login now