diff options
author | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-12 12:23:20 +0000 |
---|---|---|
committer | Jean-Philippe Lang <jp_lang@yahoo.fr> | 2012-05-12 12:23:20 +0000 |
commit | a99c61b4714c9d1b600714c78e982c5906f514ac (patch) | |
tree | 57c7f7f50d99a93b1f7f2f1d30a25c667d3dfbed /test | |
parent | 1d677ac9688a79d37caa277914864a21fb078ce0 (diff) | |
download | redmine-a99c61b4714c9d1b600714c78e982c5906f514ac.tar.gz redmine-a99c61b4714c9d1b600714c78e982c5906f514ac.zip |
Adds all/none operators to text custom field filters (#9790).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9671 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test')
-rw-r--r-- | test/fixtures/custom_fields.yml | 1 | ||||
-rw-r--r-- | test/unit/query_test.rb | 18 |
2 files changed, 19 insertions, 0 deletions
diff --git a/test/fixtures/custom_fields.yml b/test/fixtures/custom_fields.yml index e114ffa00..4052228ce 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 95dd12f1a..c1eadcf0c 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']) |