diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-02-07 08:06:38 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2014-02-07 08:06:38 +0000 |
commit | d6b718b43c4cb2d257eccca0f627b9f41099986c (patch) | |
tree | 3156e968a4a106b3bf3b36ee551551d5338f643b | |
parent | b8ffc995c187fff2f4434d17f6141190c048b0a5 (diff) | |
download | redmine-d6b718b43c4cb2d257eccca0f627b9f41099986c.tar.gz redmine-d6b718b43c4cb2d257eccca0f627b9f41099986c.zip |
Merged r12844 (#16038).
git-svn-id: http://svn.redmine.org/redmine/branches/2.4-stable@12852 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/issue.rb | 2 | ||||
-rw-r--r-- | test/unit/issue_test.rb | 23 |
2 files changed, 14 insertions, 11 deletions
diff --git a/app/models/issue.rb b/app/models/issue.rb index 582caaa60..fa4545180 100644 --- a/app/models/issue.rb +++ b/app/models/issue.rb @@ -1089,7 +1089,7 @@ class Issue < ActiveRecord::Base if user.logged? s << ' created-by-me' if author_id == user.id s << ' assigned-to-me' if assigned_to_id == user.id - s << ' assigned-to-my-group' if user.groups.any? {|g| g.id = assigned_to_id} + s << ' assigned-to-my-group' if user.groups.any? {|g| g.id == assigned_to_id} end s end diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb index 8b0252e0b..d53d551fd 100644 --- a/test/unit/issue_test.rb +++ b/test/unit/issue_test.rb @@ -2202,16 +2202,19 @@ class IssueTest < ActiveSupport::TestCase assert_include 'priority-highest', classes end - def test_css_classes_should_include_user_assignment - issue = Issue.generate(:assigned_to_id => 2) - assert_include 'assigned-to-me', issue.css_classes(User.find(2)) - assert_not_include 'assigned-to-me', issue.css_classes(User.find(3)) - end - - def test_css_classes_should_include_user_group_assignment - issue = Issue.generate(:assigned_to_id => 10) - assert_include 'assigned-to-my-group', issue.css_classes(Group.find(10).users.first) - assert_not_include 'assigned-to-my-group', issue.css_classes(User.find(3)) + def test_css_classes_should_include_user_and_group_assignment + project = Project.first + user = User.generate! + group = Group.generate! + Member.create!(:principal => group, :project => project, :role_ids => [1, 2]) + group.users << user + assert user.member_of?(project) + issue1 = Issue.generate(:assigned_to_id => group.id) + assert_include 'assigned-to-my-group', issue1.css_classes(user) + assert_not_include 'assigned-to-me', issue1.css_classes(user) + issue2 = Issue.generate(:assigned_to_id => user.id) + assert_not_include 'assigned-to-my-group', issue2.css_classes(user) + assert_include 'assigned-to-me', issue2.css_classes(user) end def test_save_attachments_with_hash_should_save_attachments_in_keys_order |