summaryrefslogtreecommitdiffstats
path: root/test/unit/query_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-08 16:01:20 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2015-02-08 16:01:20 +0000
commitc3b91d6f04432811d7535b301d891498b907f7be (patch)
tree4cb9118b69590e7e95a8de5656af08b281b94f2e /test/unit/query_test.rb
parent6aaaac237300d168a42f09a4ecf855ae1b1f9737 (diff)
downloadredmine-c3b91d6f04432811d7535b301d891498b907f7be.tar.gz
redmine-c3b91d6f04432811d7535b301d891498b907f7be.zip
Fixed assertions for SQLServer that format dates with MM/DD/YYYY in queries.
git-svn-id: http://svn.redmine.org/redmine/trunk@13992 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r--test/unit/query_test.rb20
1 files changed, 12 insertions, 8 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index 3468c9cbf..fdddba8cc 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -453,42 +453,44 @@ class QueryTest < ActiveSupport::TestCase
def test_operator_date_equals
query = IssueQuery.new(:name => '_')
query.add_filter('due_date', '=', ['2011-07-10'])
- assert_match /issues\.due_date > '2011-07-09 23:59:59(\.9+)?' AND issues\.due_date <= '2011-07-10 23:59:59(\.9+)?/, query.statement
+ assert_match /issues\.due_date > '#{quoted_date "2011-07-09"} 23:59:59(\.\d+)?' AND issues\.due_date <= '#{quoted_date "2011-07-10"} 23:59:59(\.\d+)?/,
+ query.statement
find_issues_with_query(query)
end
def test_operator_date_lesser_than
query = IssueQuery.new(:name => '_')
query.add_filter('due_date', '<=', ['2011-07-10'])
- assert_match /issues\.due_date <= '2011-07-10 23:59:59(\.9+)?/, query.statement
+ assert_match /issues\.due_date <= '#{quoted_date "2011-07-10"} 23:59:59(\.\d+)?/, query.statement
find_issues_with_query(query)
end
def test_operator_date_lesser_than_with_timestamp
query = IssueQuery.new(:name => '_')
query.add_filter('updated_on', '<=', ['2011-07-10T19:13:52'])
- assert_match /issues\.updated_on <= '2011-07-10 19:13:52/, query.statement
+ assert_match /issues\.updated_on <= '#{quoted_date "2011-07-10"} 19:13:52/, query.statement
find_issues_with_query(query)
end
def test_operator_date_greater_than
query = IssueQuery.new(:name => '_')
query.add_filter('due_date', '>=', ['2011-07-10'])
- assert_match /issues\.due_date > '2011-07-09 23:59:59(\.9+)?'/, query.statement
+ assert_match /issues\.due_date > '#{quoted_date "2011-07-09"} 23:59:59(\.\d+)?'/, query.statement
find_issues_with_query(query)
end
def test_operator_date_greater_than_with_timestamp
query = IssueQuery.new(:name => '_')
query.add_filter('updated_on', '>=', ['2011-07-10T19:13:52'])
- assert_match /issues\.updated_on > '2011-07-10 19:13:51(\.0+)?'/, query.statement
+ assert_match /issues\.updated_on > '#{quoted_date "2011-07-10"} 19:13:51(\.0+)?'/, query.statement
find_issues_with_query(query)
end
def test_operator_date_between
query = IssueQuery.new(:name => '_')
query.add_filter('due_date', '><', ['2011-06-23', '2011-07-10'])
- assert_match /issues\.due_date > '2011-06-22 23:59:59(\.9+)?' AND issues\.due_date <= '2011-07-10 23:59:59(\.9+)?'/, query.statement
+ assert_match /issues\.due_date > '#{quoted_date "2011-06-22"} 23:59:59(\.\d+)?' AND issues\.due_date <= '#{quoted_date "2011-07-10"} 23:59:59(\.\d+)?'/,
+ query.statement
find_issues_with_query(query)
end
@@ -606,7 +608,8 @@ class QueryTest < ActiveSupport::TestCase
query = IssueQuery.new(:project => Project.find(1), :name => '_')
query.add_filter('due_date', 'w', [''])
- assert query.statement.match(/issues\.due_date > '2011-04-24 23:59:59(\.9+)?' AND issues\.due_date <= '2011-05-01 23:59:59(\.9+)?/), "range not found in #{query.statement}"
+ assert_match /issues\.due_date > '#{quoted_date "2011-04-24"} 23:59:59(\.\d+)?' AND issues\.due_date <= '#{quoted_date "2011-05-01"} 23:59:59(\.\d+)?/,
+ query.statement
I18n.locale = :en
end
@@ -618,7 +621,8 @@ class QueryTest < ActiveSupport::TestCase
query = IssueQuery.new(:project => Project.find(1), :name => '_')
query.add_filter('due_date', 'w', [''])
- assert query.statement.match(/issues\.due_date > '2011-04-23 23:59:59(\.9+)?' AND issues\.due_date <= '2011-04-30 23:59:59(\.9+)?/), "range not found in #{query.statement}"
+ assert_match /issues\.due_date > '#{quoted_date "2011-04-23"} 23:59:59(\.\d+)?' AND issues\.due_date <= '#{quoted_date "2011-04-30"} 23:59:59(\.\d+)?/,
+ query.statement
end
def test_operator_does_not_contains