Browse Source

CLDC-4074 Updated sales log tests to use filters from the current year instead of a fixed one

CLDC-4074-update-tests
David May-Miller 3 weeks ago
parent
commit
f809689e0e
  1. 5
      spec/features/sales_log_spec.rb

5
spec/features/sales_log_spec.rb

@ -4,6 +4,7 @@ RSpec.describe "Sales Log Features" do
context "when searching for specific sales logs" do
context "when I am signed in and there are sales logs in the database" do
let(:user) { FactoryBot.create(:user, last_sign_in_at: Time.zone.now, name: "Jimbo") }
let(:current_year) { current_collection_start_year }
let!(:log_to_search) { FactoryBot.create(:sales_log, owning_organisation: user.organisation) }
let!(:same_organisation_log) { FactoryBot.create(:sales_log, owning_organisation: user.organisation) }
let!(:another_organisation_log) { FactoryBot.create(:sales_log) }
@ -161,7 +162,7 @@ RSpec.describe "Sales Log Features" do
expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_content("There is a problem")
choose("years-2023-field", allow_label_click: true)
choose("years-#{current_year}-field", allow_label_click: true)
click_button("Save changes")
expect(page).to have_current_path("/sales-logs/csv-download?codes_only=false&search=1")
@ -175,7 +176,7 @@ RSpec.describe "Sales Log Features" do
expect(page).to have_selector(".govuk-error-summary__title")
expect(page).to have_content("There is a problem")
choose("years-2023-field", allow_label_click: true)
choose("years-#{current_year}-field", allow_label_click: true)
click_button("Save changes")
expect(page).to have_current_path("/sales-logs/csv-download?codes_only=true&search=1")

Loading…
Cancel
Save