Fixed test failure with ruby1.8 (#8842).
git-svn-id: http://svn.redmine.org/redmine/trunk@12479 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
parent
429b3a5dae
commit
3c540594dc
|
@ -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-", "t-", ">t+", "<t+", "t+", "><t+", "><t-"
|
||||
add_filter_error(field, :invalid) if values_for(field).detect {|v| v.present? && !v.match(/^\d+$/) }
|
||||
|
|
|
@ -449,6 +449,13 @@ class QueryTest < ActiveSupport::TestCase
|
|||
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
|
||||
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'])
|
||||
|
|
Loading…
Reference in New Issue