diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-11-07 09:20:36 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2015-11-07 09:20:36 +0000 |
commit | d3d7678c7689ed6c90fd6058b16c18fc7130c0cf (patch) | |
tree | fb6d5b7457a8f8ca0c67e56b2896f1a5ff086fbb /test | |
parent | 8123006bb3a43c3dd1cab8f849c51b79362c6b3a (diff) | |
download | redmine-d3d7678c7689ed6c90fd6058b16c18fc7130c0cf.tar.gz redmine-d3d7678c7689ed6c90fd6058b16c18fc7130c0cf.zip |
Ability to filter issues blocked by any/no open issues (#16621).
Patch by Arthur Andersen.
git-svn-id: http://svn.redmine.org/redmine/trunk@14809 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/query_test.rb | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index af079eb53..f7480e2af 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -846,6 +846,34 @@ class QueryTest < ActiveSupport::TestCase assert_not_include 3, ids end + def test_filter_on_relations_with_any_open_issues + IssueRelation.delete_all + # Issue 1 is blocked by 8, which is closed + IssueRelation.create!(:relation_type => "blocked", :issue_from => Issue.find(1), :issue_to => Issue.find(8)) + # Issue 2 is blocked by 3, which is open + IssueRelation.create!(:relation_type => "blocked", :issue_from => Issue.find(2), :issue_to => Issue.find(3)) + + query = IssueQuery.new(:name => '_') + query.filters = {"blocked" => {:operator => "*o", :values => ['']}} + ids = find_issues_with_query(query).map(&:id) + assert_equal [], ids & [1] + assert_include 2, ids + end + + def test_filter_on_relations_with_no_open_issues + IssueRelation.delete_all + # Issue 1 is blocked by 8, which is closed + IssueRelation.create!(:relation_type => "blocked", :issue_from => Issue.find(1), :issue_to => Issue.find(8)) + # Issue 2 is blocked by 3, which is open + IssueRelation.create!(:relation_type => "blocked", :issue_from => Issue.find(2), :issue_to => Issue.find(3)) + + query = IssueQuery.new(:name => '_') + query.filters = {"blocked" => {:operator => "!o", :values => ['']}} + ids = find_issues_with_query(query).map(&:id) + assert_equal [], ids & [2] + assert_include 1, ids + end + def test_filter_on_relations_with_no_issues IssueRelation.delete_all IssueRelation.create!(:relation_type => "relates", :issue_from => Issue.find(1), :issue_to => Issue.find(2)) |