summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-09 09:12:29 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2009-12-09 09:12:29 +0000
commitf2520385e44587c9b712161ff5f5c6cb9a20fe5b (patch)
treeacbf593b7e0dac4dfb30e3020ab1a78f5e97bad9 /test
parent1de2a0b7c7b99f5ea4c30b67e736caf63943ac19 (diff)
downloadredmine-f2520385e44587c9b712161ff5f5c6cb9a20fe5b.tar.gz
redmine-f2520385e44587c9b712161ff5f5c6cb9a20fe5b.zip
Fixes tracker_id and custom_field_values assignment order for issues (#4353).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3139 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/issue_test.rb17
1 files changed, 17 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index dd732f97f..e91880c08 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -164,6 +164,23 @@ class IssueTest < ActiveSupport::TestCase
assert_equal custom_value.id, issue.custom_value_for(field).id
end
+ def test_assigning_tracker_id_should_reload_custom_fields_values
+ issue = Issue.new(:project => Project.find(1))
+ assert issue.custom_field_values.empty?
+ issue.tracker_id = 1
+ assert issue.custom_field_values.any?
+ end
+
+ def test_assigning_attributes_should_assign_tracker_id_first
+ attributes = ActiveSupport::OrderedHash.new
+ attributes['custom_field_values'] = { '1' => 'MySQL' }
+ attributes['tracker_id'] = '1'
+ issue = Issue.new(:project => Project.find(1))
+ issue.attributes = attributes
+ assert_not_nil issue.custom_value_for(1)
+ assert_equal 'MySQL', issue.custom_value_for(1).value
+ end
+
def test_should_update_issue_with_disabled_tracker
p = Project.find(1)
issue = Issue.find(1)