summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-08 20:37:12 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-12-08 20:37:12 +0000
commit42d2bf0bafcec34c54dbadfdc3136c674c826962 (patch)
tree18b5441282187d92910af8d9acf25d3893faa325 /test
parentd75bc5774f1e36a1a6fa1e750a785c07c7d288c0 (diff)
downloadredmine-42d2bf0bafcec34c54dbadfdc3136c674c826962.tar.gz
redmine-42d2bf0bafcec34c54dbadfdc3136c674c826962.zip
Makes project and tracker assigned first in #attributes=
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8131 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/issue_test.rb16
1 files changed, 11 insertions, 5 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index d006d7b42..b2e243835 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -279,10 +279,7 @@ class IssueTest < ActiveSupport::TestCase
end
def test_should_not_update_custom_fields_on_changing_tracker_with_different_custom_fields
- issue = Issue.new(:project_id => 1)
- issue.attributes = {:tracker_id => 1, :author_id => 1, :status_id => 1, :subject => 'Test', :custom_field_values => {'2' => 'Test'}}
- issue.save!
-
+ issue = Issue.create!(:project_id => 1, :tracker_id => 1, :author_id => 1, :status_id => 1, :subject => 'Test', :custom_field_values => {'2' => 'Test'})
assert !Tracker.find(2).custom_field_ids.include?(2)
issue = Issue.find(issue.id)
@@ -301,7 +298,16 @@ class IssueTest < ActiveSupport::TestCase
assert issue.custom_field_values.any?
end
- def test_assigning_attributes_should_assign_tracker_id_first
+ def test_assigning_attributes_should_assign_project_and_tracker_first
+ seq = sequence('seq')
+ issue = Issue.new
+ issue.expects(:project_id=).in_sequence(seq)
+ issue.expects(:tracker_id=).in_sequence(seq)
+ issue.expects(:subject=).in_sequence(seq)
+ issue.attributes = {:tracker_id => 2, :project_id => 1, :subject => 'Test'}
+ end
+
+ def test_assigning_tracker_and_custom_fields_should_assign_custom_fields
attributes = ActiveSupport::OrderedHash.new
attributes['custom_field_values'] = { '1' => 'MySQL' }
attributes['tracker_id'] = '1'