summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorGo MAEDA <maeda@farend.jp>2021-06-14 07:01:27 +0000
committerGo MAEDA <maeda@farend.jp>2021-06-14 07:01:27 +0000
commita0bf4e5cd34e90fc0505283d01e858a2e03f351e (patch)
tree7545a7cf58edd4254238c24a1010bff8345a3eca /test/unit/query_test.rb
parent9e3d772e15bf9738dedc6cb190608845820d9c8e (diff)
downloadredmine-a0bf4e5cd34e90fc0505283d01e858a2e03f351e.tar.gz
redmine-a0bf4e5cd34e90fc0505283d01e858a2e03f351e.zip
Filter issues by file description (#34715).
Patch by Yuichi HARADA. git-svn-id: http://svn.redmine.org/redmine/trunk@21034 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb42
1 files changed, 42 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index d2159c84b..07921a951 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -1527,6 +1527,48 @@ class QueryTest < ActiveSupport::TestCase
assert_equal [3, 4], issues.collect(&:id).sort
end
+ def test_filter_on_attachment_description_when_any
+ query = IssueQuery.new(:name => '_')
+ query.filters = {"attachment_description" => {:operator => '*', :values => ['']}}
+ issues = find_issues_with_query(query)
+ assert_equal [2, 3, 14], issues.collect(&:id).sort
+ end
+
+ def test_filter_on_attachment_description_when_none
+ query = IssueQuery.new(:name => '_')
+ query.filters = {"attachment_description" => {:operator => '!*', :values => ['']}}
+ issues = find_issues_with_query(query)
+ assert_equal [2, 3, 4, 14], issues.collect(&:id).sort
+ end
+
+ def test_filter_on_attachment_description_when_contains
+ query = IssueQuery.new(:name => '_')
+ query.filters = {"attachment_description" => {:operator => '~', :values => ['attachment']}}
+ issues = find_issues_with_query(query)
+ assert_equal [3, 14], issues.collect(&:id).sort
+ end
+
+ def test_filter_on_attachment_description_when_does_not_contain
+ query = IssueQuery.new(:name => '_')
+ query.filters = {"attachment_description" => {:operator => '!~', :values => ['attachment']}}
+ issues = find_issues_with_query(query)
+ assert_equal [2], issues.collect(&:id).sort
+ end
+
+ def test_filter_on_attachment_description_when_starts_with
+ query = IssueQuery.new(:name => '_')
+ query.filters = {"attachment_description" => {:operator => '^', :values => ['attachment']}}
+ issues = find_issues_with_query(query)
+ assert_equal [14], issues.collect(&:id).sort
+ end
+
+ def test_filter_on_attachment_description_when_ends_with
+ query = IssueQuery.new(:name => '_')
+ query.filters = {"attachment_description" => {:operator => '$', :values => ['attachment']}}
+ issues = find_issues_with_query(query)
+ assert_equal [3], issues.collect(&:id).sort
+ end
+
def test_filter_on_subject_when_starts_with
query = IssueQuery.new(:name => '_')
query.filters = {'subject' => {:operator => '^', :values => ['issue']}}