Skip to content

Commit

Permalink
Update controller index action to order product drives by reverse chr…
Browse files Browse the repository at this point in the history
…onological start date and add system test (#4044)
  • Loading branch information
MooseCowBear authored Jan 19, 2024
1 parent eb98688 commit 8fd617f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -740,4 +740,4 @@ DEPENDENCIES
webmock (~> 3.19)

BUNDLED WITH
2.4.22
2.5.4
2 changes: 1 addition & 1 deletion app/controllers/product_drives_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ def index
.product_drives
.class_filter(filter_params)
.within_date_range(@selected_date_range)
.order(created_at: :desc)
.order(start_date: :desc)
@selected_name_filter = filter_params[:by_name]

respond_to do |format|
Expand Down
4 changes: 4 additions & 0 deletions spec/system/product_drive_system_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@
it 'shows only one non-virtual product drive' do
expect(page).to have_text(/No/, maximum: 1)
end

it 'shows in descending order of start date' do
expect("Test name 2").to appear_before("Test name 1")
end
end

context 'when creating a normal product drive' do
Expand Down

0 comments on commit 8fd617f

Please sign in to comment.