Commit e37cb267 authored by Nick Kipling's avatar Nick Kipling

Added test cases and sort_param default

parent 13d3e75a
......@@ -95,7 +95,7 @@ module EE
end
def packages_sort_option_title(sort_value)
packages_sort_options_hash[sort_value]
packages_sort_options_hash[sort_value] || sort_title_created_date
end
def packages_sort_direction_button(sort_value)
......
......@@ -77,6 +77,20 @@ describe 'Group Packages' do
project: second_project)
end
it 'sorts by created date descending by default' do
visit group_packages_path(group)
expect(sort_dropdown_button_text).to eq(sort_title_created_date)
expect(first_package).to include(bbb_package.name)
expect(last_package).to include(aaa_package.name)
end
it 'handles an invalid param' do
visit group_packages_path(group, sort: 'garbage') # bad sort param
expect(sort_dropdown_button_text).to eq(sort_title_created_date)
expect(first_package).to include(bbb_package.name)
expect(last_package).to include(aaa_package.name)
end
it 'sorts by created date descending' do
visit group_packages_path(group, sort: sort_value_recently_created)
expect(sort_dropdown_button_text).to eq(sort_title_created_date)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment