summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-28 15:29:31 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2013-07-28 15:29:31 +0000
commit4a70a319c5e6aba1779b18ee31a63f0961846373 (patch)
treee6a75f3ab8d8bf5a634226b4df2bb0d48ef5cb62 /test/unit/query_test.rb
parent76e48c391454ee09628059b3a3675a1db7319988 (diff)
downloadredmine-4a70a319c5e6aba1779b18ee31a63f0961846373.tar.gz
redmine-4a70a319c5e6aba1779b18ee31a63f0961846373.zip
Filtering issues on "related to" may ignore other filters (#14401).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@12058 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 4ec430cf7..12580bfd0 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -791,6 +791,21 @@ class QueryTest < ActiveSupport::TestCase
assert_equal [1, 2, 3], find_issues_with_query(query).map(&:id).sort
end
+ def test_filter_on_relations_should_not_ignore_other_filter
+ issue = Issue.generate!
+ issue1 = Issue.generate!(:status_id => 1)
+ issue2 = Issue.generate!(:status_id => 2)
+ IssueRelation.create!(:relation_type => "relates", :issue_from => issue, :issue_to => issue1)
+ IssueRelation.create!(:relation_type => "relates", :issue_from => issue, :issue_to => issue2)
+
+ query = IssueQuery.new(:name => '_')
+ query.filters = {
+ "status_id" => {:operator => '=', :values => ['1']},
+ "relates" => {:operator => '=', :values => [issue.id.to_s]}
+ }
+ assert_equal [issue1], find_issues_with_query(query)
+ end
+
def test_statement_should_be_nil_with_no_filters
q = IssueQuery.new(:name => '_')
q.filters = {}