summaryrefslogtreecommitdiffstats
path: root/test/unit/issue_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-21 17:00:14 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-10-21 17:00:14 +0000
commit8160f2addb05c662c5a9f20d7dfdf66e0e41534b (patch)
treed4a97ba823cdea4c9d479bcd5097e6ca0ffe20bd /test/unit/issue_test.rb
parentd6c6c7ac62bf3cf0003cc950880de5597611eb1d (diff)
downloadredmine-8160f2addb05c662c5a9f20d7dfdf66e0e41534b.tar.gz
redmine-8160f2addb05c662c5a9f20d7dfdf66e0e41534b.zip
Adds a scope to get issues assigned to a user.
git-svn-id: http://svn.redmine.org/redmine/trunk@14720 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/issue_test.rb')
-rw-r--r--test/unit/issue_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/issue_test.rb b/test/unit/issue_test.rb
index bed63b767..4b9fbda0b 100644
--- a/test/unit/issue_test.rb
+++ b/test/unit/issue_test.rb
@@ -418,6 +418,22 @@ class IssueTest < ActiveSupport::TestCase
assert_equal 0, Issue.fixed_version([]).count
end
+ def test_assigned_to_scope_should_return_issues_assigned_to_the_user
+ user = User.generate!
+ issue = Issue.generate!
+ Issue.where(:id => issue.id).update_all :assigned_to_id => user.id
+ assert_equal [issue], Issue.assigned_to(user).to_a
+ end
+
+ def test_assigned_to_scope_should_return_issues_assigned_to_the_user_groups
+ group = Group.generate!
+ user = User.generate!
+ group.users << user
+ issue = Issue.generate!
+ Issue.where(:id => issue.id).update_all :assigned_to_id => group.id
+ assert_equal [issue], Issue.assigned_to(user).to_a
+ end
+
def test_errors_full_messages_should_include_custom_fields_errors
field = IssueCustomField.find_by_name('Database')