diff options
author | Go MAEDA <maeda@farend.jp> | 2023-12-29 08:24:43 +0000 |
---|---|---|
committer | Go MAEDA <maeda@farend.jp> | 2023-12-29 08:24:43 +0000 |
commit | 13028b913b56eb4b5a7007ea5eea65ea2b19828e (patch) | |
tree | 2bde62b1fcb23297c66182b6048ba05e5ad9368c /test | |
parent | f02e2c088bf902f20a21d563f49f426bc063de25 (diff) | |
download | redmine-13028b913b56eb4b5a7007ea5eea65ea2b19828e.tar.gz redmine-13028b913b56eb4b5a7007ea5eea65ea2b19828e.zip |
Extend "contains" operator in "Parent task" filter to support multiple issue IDs (#39805).
Patch by Go MAEDA (@maeda).
git-svn-id: https://svn.redmine.org/redmine/trunk@22577 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/query_test.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index a630f75d8..a1c528e26 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -1819,6 +1819,31 @@ class QueryTest < ActiveSupport::TestCase assert_equal [], find_issues_with_query(query) end + def test_operator_contains_on_parent_id_should_accept_comma_separated_values + parent1 = Issue.generate! + children_of_parent1 = [ + Issue.generate!(parent_id: parent1.id), + Issue.generate!(parent_id: parent1.id) + ] + parent2 = Issue.generate! + children_of_parent2 = [ + Issue.generate!(parent_id: parent2.id), + Issue.generate!(parent_id: parent2.id) + ] + grandchild_of_parent2 = [ + Issue.generate!(parent_id: children_of_parent2.first.id) + ] + + query = IssueQuery.new(name: '_') + query.add_filter('parent_id', '~', ["#{parent1.id},#{parent2.id}"]) + issues = find_issues_with_query(query) + + expected = + children_of_parent1 + children_of_parent2 + grandchild_of_parent2 + assert_equal expected.size, issues.size + assert_equal expected.map(&:id).sort, issues.map(&:id).sort + end + def test_filter_on_child Issue.delete_all parent = Issue.generate_with_descendants! |