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