summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-11 14:13:59 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2011-07-11 14:13:59 +0000
commit308a922d80331d139b576d44728e1c49d5321a7f (patch)
tree3a5dd5475c6e00decd2f375677ce1967ab85b28c /test
parentdb1bfbd01801eb04472cc3baa9c19cc96a489303 (diff)
downloadredmine-308a922d80331d139b576d44728e1c49d5321a7f.tar.gz
redmine-308a922d80331d139b576d44728e1c49d5321a7f.zip
Validate date filters values.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@6264 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r--test/unit/query_test.rb16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index ef48a8ad8..a722807db 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -170,6 +170,22 @@ class QueryTest < ActiveSupport::TestCase
assert_include "CAST(custom_values.value AS decimal(60,3)) BETWEEN 30.0 AND 40.0", query.statement
find_issues_with_query(query)
end
+
+ def test_date_filter_should_not_accept_non_date_values
+ query = Query.new(:name => '_')
+ query.add_filter('created_on', '=', ['a'])
+
+ assert query.has_filter?('created_on')
+ assert !query.valid?
+ end
+
+ def test_relative_date_filter_should_not_accept_non_integer_values
+ query = Query.new(:name => '_')
+ query.add_filter('created_on', '>t-', ['a'])
+
+ assert query.has_filter?('created_on')
+ assert !query.valid?
+ end
def test_operator_date_equals
query = Query.new(:name => '_')