summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-08-02 08:32:18 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-08-02 08:32:18 +0000
commitd4723bb05ff43a4c6e282b12249c71697f7929ce (patch)
treecb74d5b98211bf095b34eb08fda3c8382183b8e1 /test/unit/query_test.rb
parentdf1093a4afd5799bef71143582646840174a615c (diff)
downloadredmine-d4723bb05ff43a4c6e282b12249c71697f7929ce.tar.gz
redmine-d4723bb05ff43a4c6e282b12249c71697f7929ce.zip
Query doesn't work with non ASCII uppercase symbols (#20438).
git-svn-id: http://svn.redmine.org/redmine/trunk@14476 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb27
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)