diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-31 10:22:36 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2011-07-31 10:22:36 +0000 |
commit | 7f77744e86e0db306083a43a2da4b8ab508da7e1 (patch) | |
tree | 6a49eb549ba9991221f1ccaf07fd029ffca0173c /test/unit/query_test.rb | |
parent | 8ba74845bc9f959fe05e17c559d572c0ec1dbaff (diff) | |
download | redmine-7f77744e86e0db306083a43a2da4b8ab508da7e1.tar.gz redmine-7f77744e86e0db306083a43a2da4b8ab508da7e1.zip |
Include issues asigned to user's groups when using "assigned to me" filter (#2964).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6332 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r-- | test/unit/query_test.rb | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 9cba0cd64..6ac713b15 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -336,6 +336,24 @@ class QueryTest < ActiveSupport::TestCase find_issues_with_query(query) end + def test_filter_assigned_to_me + user = User.find(2) + group = Group.find(10) + User.current = user + i1 = Issue.generate!(:project_id => 1, :tracker_id => 1, :assigned_to => user) + i2 = Issue.generate!(:project_id => 1, :tracker_id => 1, :assigned_to => group) + i3 = Issue.generate!(:project_id => 1, :tracker_id => 1, :assigned_to => Group.find(11)) + group.users << user + + query = Query.new(:name => '_', :filters => { 'assigned_to_id' => {:operator => '=', :values => ['me']}}) + result = query.issues + assert_equal Issue.visible.all(:conditions => {:assigned_to_id => ([2] + user.reload.group_ids)}).sort_by(&:id), result.sort_by(&:id) + + assert result.include?(i1) + assert result.include?(i2) + assert !result.include?(i3) + end + def test_filter_watched_issues User.current = User.find(1) query = Query.new(:name => '_', :filters => { 'watcher_id' => {:operator => '=', :values => ['me']}}) |