diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-04-14 17:01:23 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-04-14 17:01:23 +0000 |
commit | a9f052532e3ea4267714610307036558929ea672 (patch) | |
tree | 84af874af5372caf28c4960dcf81e23722e78453 /test/unit/issue_test.rb | |
parent | 0a32e898f1ce39163ab60be56cf68ffad9a191b3 (diff) | |
download | redmine-a9f052532e3ea4267714610307036558929ea672.tar.gz redmine-a9f052532e3ea4267714610307036558929ea672.zip |
Fixed workflow rules when user has duplicated role by inheritance (#19569).
git-svn-id: http://svn.redmine.org/redmine/trunk@14179 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r-- | test/unit/issue_test.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 5d11f8cc3..fca74cdbc 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -981,6 +981,27 @@ class IssueTest < ActiveSupport::TestCase assert_equal %w(done_ratio start_date), issue.read_only_attribute_names(user).sort end + def test_workflow_rules_should_work_for_member_with_duplicate_role + WorkflowPermission.delete_all + WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, + :role_id => 1, :field_name => 'due_date', + :rule => 'required') + WorkflowPermission.create!(:old_status_id => 1, :tracker_id => 1, + :role_id => 1, :field_name => 'start_date', + :rule => 'readonly') + + user = User.generate! + m = Member.new(:user_id => user.id, :project_id => 1) + m.member_roles.build(:role_id => 1) + m.member_roles.build(:role_id => 1) + m.save! + + issue = Issue.new(:project_id => 1, :tracker_id => 1, :status_id => 1) + + assert_equal %w(due_date), issue.required_attribute_names(user) + assert_equal %w(start_date), issue.read_only_attribute_names(user) + end + def test_copy issue = Issue.new.copy_from(1) assert issue.copy? |