From 3c540594dc597c593afebbe31db6262f3a7f13f8 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 3 Jan 2014 19:42:43 +0000 Subject: [PATCH] Fixed test failure with ruby1.8 (#8842). git-svn-id: http://svn.redmine.org/redmine/trunk@12479 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- app/models/query.rb | 2 +- test/unit/query_test.rb | 14 ++++++++++++++ 2 files changed, 15 insertions(+), 1 deletion(-) diff --git a/app/models/query.rb b/app/models/query.rb index 78c1f72a5..8830cc5b6 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -243,7 +243,7 @@ class Query < ActiveRecord::Base case operator_for(field) when "=", ">=", "<=", "><" add_filter_error(field, :invalid) if values_for(field).detect {|v| - v.present? && (!v.match(/\A\d{4}-\d{2}-\d{2}(T\d{2}((:)?\d{2}){,2}(Z|\d{2}:?\d{2})?)?\z/) || parse_date(v).nil?) + v.present? && (!v.match(/\A\d{4}-\d{2}-\d{2}(T\d{2}((:)?\d{2}){0,2}(Z|\d{2}:?\d{2})?)?\z/) || parse_date(v).nil?) } when ">t-", "t+", " '_') + query.add_filter('updated_on', '<=', ['2011-07-10T19:13:52']) + assert_match /issues\.updated_on <= '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']) @@ -456,6 +463,13 @@ class QueryTest < ActiveSupport::TestCase 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'/, 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'])