Don't fail if new filter is added.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@11401 e93f8b46-1217-0410-a6f0-8f06a7374b81
This commit is contained in:
Jean-Philippe Lang 2013-02-16 09:12:21 +00:00
parent d5f1e186f1
commit 723e21243e
1 changed files with 24 additions and 19 deletions

View File

@ -30,18 +30,20 @@ class QueriesHelperTest < ActionView::TestCase
:custom_fields_trackers :custom_fields_trackers
def test_filters_options_should_be_ordered def test_filters_options_should_be_ordered
User.current = User.find_by_login('admin') set_language_if_valid 'en'
query = IssueQuery.new(:project => nil, :name => '_') query = IssueQuery.new
assert_equal 30, query.available_filters.size filter_count = query.available_filters.size
fo = filters_options(query) fo = filters_options(query)
assert_equal 31, fo.size assert_equal filter_count + 1, fo.size
assert_equal [], fo[0] assert_equal [], fo[0]
assert_equal "status_id", fo[1][1]
assert_equal "project_id", fo[2][1] expected_order = [
assert_equal "tracker_id", fo[3][1] "Status",
assert_equal "priority_id", fo[4][1] "Project",
assert_equal "is_private", fo[17][1] "Tracker",
assert_equal "watcher_id", fo[18][1] "Priority"
]
assert_equal expected_order, (fo.map(&:first) & expected_order)
end end
def test_filters_options_should_be_ordered_with_custom_fields def test_filters_options_should_be_ordered_with_custom_fields
@ -50,15 +52,18 @@ class QueriesHelperTest < ActionView::TestCase
:name => 'order test', :field_format => 'string', :name => 'order test', :field_format => 'string',
:is_for_all => true, :is_filter => true :is_for_all => true, :is_filter => true
) )
User.current = User.find_by_login('admin') query = IssueQuery.new
query = IssueQuery.new(:project => nil, :name => '_') filter_count = query.available_filters.size
assert_equal 32, query.available_filters.size
fo = filters_options(query) fo = filters_options(query)
assert_equal 33, fo.size assert_equal filter_count + 1, fo.size
assert_equal "Searchable field", fo[19][0]
assert_equal "Database", fo[20][0] expected_order = [
assert_equal "Project's Development status", fo[21][0] "Searchable field",
assert_equal "Author's order test", fo[22][0] "Database",
assert_equal "Assignee's order test", fo[23][0] "Project's Development status",
"Author's order test",
"Assignee's order test"
]
assert_equal expected_order, (fo.map(&:first) & expected_order)
end end
end end