summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-13 18:16:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-01-13 18:16:15 +0000
commit919d0a68c39b14ac8970ad889e6dc9345fade7f0 (patch)
tree4987968f7749f8591e8bc6d73b2e620b89c9eeff /test
parent1054237d821b0a2a5e3bb24eed1f469d423d0dc7 (diff)
downloadredmine-919d0a68c39b14ac8970ad889e6dc9345fade7f0.tar.gz
redmine-919d0a68c39b14ac8970ad889e6dc9345fade7f0.zip
Adds "my projects" filter on the cross-project issue list.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8637 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/query_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 78499bfd0..d958fd131 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -413,6 +413,19 @@ class QueryTest < ActiveSupport::TestCase
assert !result.include?(i3)
end
+ def test_filter_my_projects
+ User.current = User.find(2)
+ query = Query.new(:name => '_')
+ filter = query.available_filters['project_id']
+ assert_not_nil filter
+ assert_include 'mine', filter[:values].map{|v| v[1]}
+
+ query.filters = { 'project_id' => {:operator => '=', :values => ['mine']}}
+ result = query.issues
+ assert_include "issues.project_id IN ('1','2','5')", query.statement
+ assert_nil result.detect {|issue| !User.current.member_of?(issue.project)}
+ end
+
def test_filter_watched_issues
User.current = User.find(1)
query = Query.new(:name => '_', :filters => { 'watcher_id' => {:operator => '=', :values => ['me']}})