diff options
author | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-05-16 10:55:27 +0000 |
---|---|---|
committer | Toshi MARUYAMA <marutosijp2@yahoo.co.jp> | 2013-05-16 10:55:27 +0000 |
commit | f2a609c3589cb64ec36b4e3ccc64428af4f2439d (patch) | |
tree | 7d503621582290d49605a47865c66679461cd043 /test/unit/query_test.rb | |
parent | 559aa626cd24e0e2c6259b42749c15fcbde1ab55 (diff) | |
download | redmine-f2a609c3589cb64ec36b4e3ccc64428af4f2439d.tar.gz redmine-f2a609c3589cb64ec36b4e3ccc64428af4f2439d.zip |
move filter order tests from helper to model.
r11372 (#13154) moves filter order logic from helper to model.
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11848 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/unit/query_test.rb')
-rw-r--r-- | test/unit/query_test.rb | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/test/unit/query_test.rb b/test/unit/query_test.rb index bf194155e..865f6983c 100644 --- a/test/unit/query_test.rb +++ b/test/unit/query_test.rb @@ -29,8 +29,35 @@ class QueryTest < ActiveSupport::TestCase :custom_fields_trackers def test_available_filters_should_be_ordered + set_language_if_valid 'en' query = IssueQuery.new assert_equal 0, query.available_filters.keys.index('status_id') + expected_order = [ + "Status", + "Project", + "Tracker", + "Priority" + ] + assert_equal expected_order, + (query.available_filters.values.map{|v| v[:name]} & expected_order) + end + + def test_available_filters_with_custom_fields_should_be_ordered + set_language_if_valid 'en' + UserCustomField.create!( + :name => 'order test', :field_format => 'string', + :is_for_all => true, :is_filter => true + ) + query = IssueQuery.new + expected_order = [ + "Searchable field", + "Database", + "Project's Development status", + "Author's order test", + "Assignee's order test" + ] + assert_equal expected_order, + (query.available_filters.values.map{|v| v[:name]} & expected_order) end def test_custom_fields_for_all_projects_should_be_available_in_global_queries |