diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-12 12:42:30 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-12 12:42:30 +0000 |
commit | 9cfb7e1c8753aa4aa22e0690e0df694923d919c9 (patch) | |
tree | d4cff1c1474a56706b8ad298b037d7f4981e36cd | |
parent | 78c185abde71a87231f95f077045054b1c89f75b (diff) | |
download | redmine-9cfb7e1c8753aa4aa22e0690e0df694923d919c9.tar.gz redmine-9cfb7e1c8753aa4aa22e0690e0df694923d919c9.zip |
Merged r9671 from trunk.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/branches/1.4-stable@9672 e93f8b46-1217-0410-a6f0-8f06a7374b81
-rw-r--r-- | app/models/query.rb | 4 | ||||
-rw-r--r-- | test/fixtures/custom_fields.yml | 1 | ||||
-rw-r--r-- | test/unit/query_test.rb | 18 |
3 files changed, 21 insertions, 2 deletions
diff --git a/app/models/query.rb b/app/models/query.rb index 4e72ae5c7..7fffc136c 100644 --- a/app/models/query.rb +++ b/app/models/query.rb @@ -126,8 +126,8 @@ class Query < ActiveRecord::Base :list_subprojects => [ "*", "!*", "=" ], :date => [ "=", ">=", "<=", "><", "<t+", ">t+", "t+", "t", "w", ">t-", "<t-", "t-", "!*", "*" ], :date_past => [ "=", ">=", "<=", "><", ">t-", "<t-", "t-", "t", "w", "!*", "*" ], - :string => [ "=", "~", "!", "!~" ], - :text => [ "~", "!~" ], + :string => [ "=", "~", "!", "!~", "!*", "*" ], + :text => [ "~", "!~", "!*", "*" ], :integer => [ "=", ">=", "<=", "><", "!*", "*" ], :float => [ "=", ">=", "<=", "><", "!*", "*" ] } diff --git a/test/fixtures/custom_fields.yml b/test/fixtures/custom_fields.yml index b99de35a3..1f1b34b30 100644 --- a/test/fixtures/custom_fields.yml +++ b/test/fixtures/custom_fields.yml @@ -21,6 +21,7 @@ custom_fields_002: min_length: 1 regexp: "" is_for_all: true + is_filter: true type: IssueCustomField max_length: 100 possible_values: "" diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index 52e29de7e..091030104 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -112,6 +112,15 @@ class QueryTest < ActiveSupport::TestCase assert issues.all? {|i| i.start_date.nil?} end + def test_operator_none_for_string_custom_field + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('cf_2', '!*', ['']) + assert query.has_filter?('cf_2') + issues = find_issues_with_query(query) + assert !issues.empty? + assert issues.all? {|i| i.custom_field_value(2).blank?} + end + def test_operator_all query = Query.new(:project => Project.find(1), :name => '_') query.add_filter('fixed_version_id', '*', ['']) @@ -129,6 +138,15 @@ class QueryTest < ActiveSupport::TestCase assert issues.all? {|i| i.start_date.present?} end + def test_operator_all_for_string_custom_field + query = Query.new(:project => Project.find(1), :name => '_') + query.add_filter('cf_2', '*', ['']) + assert query.has_filter?('cf_2') + issues = find_issues_with_query(query) + assert !issues.empty? + assert issues.all? {|i| i.custom_field_value(2).present?} + end + def test_numeric_filter_should_not_accept_non_numeric_values query = Query.new(:name => '_') query.add_filter('estimated_hours', '=', ['a']) |