diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/unit/query_test.rb | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 1907cd9b3..aa45b5beb 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -592,12 +592,22 @@ class QueryTest < ActiveSupport::TestCase end def test_operator_contains - query = IssueQuery.new(:project => Project.find(1), :name => '_') - query.add_filter('subject', '~', ['uNable']) - assert query.statement.include?("LOWER(#{Issue.table_name}.subject) LIKE '%unable%'") + issue = Issue.generate!(:subject => 'AbCdEfG') + + query = IssueQuery.new(:name => '_') + query.add_filter('subject', '~', ['cdeF']) + result = find_issues_with_query(query) + assert_include issue, result + result.each {|issue| assert issue.subject.downcase.include?('cdef') } + end + + def test_operator_does_not_contain + issue = Issue.generate!(:subject => 'AbCdEfG') + + query = IssueQuery.new(:name => '_') + query.add_filter('subject', '!~', ['cdeF']) result = find_issues_with_query(query) - assert result.empty? - result.each {|issue| assert issue.subject.downcase.include?('unable') } + assert_not_include issue, result end def test_range_for_this_week_with_week_starting_on_monday @@ -625,13 +635,6 @@ class QueryTest < ActiveSupport::TestCase query.statement end - def test_operator_does_not_contains - query = IssueQuery.new(:project => Project.find(1), :name => '_') - query.add_filter('subject', '!~', ['uNable']) - assert query.statement.include?("LOWER(#{Issue.table_name}.subject) NOT LIKE '%unable%'") - find_issues_with_query(query) - end - def test_filter_assigned_to_me user = User.find(2) group = Group.find(10) |