From 8fd617ff32958c605ed78488db537db9833b245d Mon Sep 17 00:00:00 2001 From: Alisa <82609260+MooseCowBear@users.noreply.github.com> Date: Fri, 19 Jan 2024 15:15:22 -0500 Subject: [PATCH] Update controller index action to order product drives by reverse chronological start date and add system test (#4044) --- Gemfile.lock | 2 +- app/controllers/product_drives_controller.rb | 2 +- spec/system/product_drive_system_spec.rb | 4 ++++ 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/Gemfile.lock b/Gemfile.lock index e9b8eac514..b0135ef0a7 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -740,4 +740,4 @@ DEPENDENCIES webmock (~> 3.19) BUNDLED WITH - 2.4.22 + 2.5.4 diff --git a/app/controllers/product_drives_controller.rb b/app/controllers/product_drives_controller.rb index c6fe48c1d3..137697fdec 100644 --- a/app/controllers/product_drives_controller.rb +++ b/app/controllers/product_drives_controller.rb @@ -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| diff --git a/spec/system/product_drive_system_spec.rb b/spec/system/product_drive_system_spec.rb index edaa9e65a8..8e1866201f 100644 --- a/spec/system/product_drive_system_spec.rb +++ b/spec/system/product_drive_system_spec.rb @@ -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