summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/models/query.rb4
-rw-r--r--test/unit/query_test.rb16
2 files changed, 18 insertions, 2 deletions
diff --git a/app/models/query.rb b/app/models/query.rb
index 9eac4b81c..c25b75f2c 100644
--- a/app/models/query.rb
+++ b/app/models/query.rb
@@ -120,8 +120,8 @@ class Query < ActiveRecord::Base
:list_status => [ "o", "=", "!", "c", "*" ],
:list_optional => [ "=", "!", "!*", "*" ],
:list_subprojects => [ "*", "!*", "=" ],
- :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-" ],
- :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w" ],
+ :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ],
+ :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ],
:string => [ "=", "~", "!", "!~" ],
:text => [ "~", "!~" ],
:integer => [ "=", ">=", "<=", "><", "!*", "*" ],
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb
index e364fdde3..11e6151b3 100644
--- a/test/unit/query_test.rb
+++ b/test/unit/query_test.rb
@@ -97,6 +97,14 @@ class QueryTest < ActiveSupport::TestCase
assert issues.all? {|i| !i.estimated_hours}
end
+ def test_operator_none_for_date
+ query = Query.new(:project => Project.find(1), :name => '_')
+ query.add_filter('start_date', '!*', [''])
+ issues = find_issues_with_query(query)
+ assert !issues.empty?
+ assert issues.all? {|i| i.start_date.nil?}
+ end
+
def test_operator_all
query = Query.new(:project => Project.find(1), :name => '_')
query.add_filter('fixed_version_id', '*', [''])
@@ -106,6 +114,14 @@ class QueryTest < ActiveSupport::TestCase
find_issues_with_query(query)
end
+ def test_operator_all_for_date
+ query = Query.new(:project => Project.find(1), :name => '_')
+ query.add_filter('start_date', '*', [''])
+ issues = find_issues_with_query(query)
+ assert !issues.empty?
+ assert issues.all? {|i| i.start_date.present?}
+ end
+
def test_numeric_filter_should_not_accept_non_numeric_values
query = Query.new(:name => '_')
query.add_filter('estimated_hours', '=', ['a'])