From 822d44d31320ce58fa443960c3e637b6fe32750d Mon Sep 17 00:00:00 2001 From: natdeanlewissoftwire Date: Fri, 8 Dec 2023 12:07:33 +0000 Subject: [PATCH] feat: update tests --- spec/requests/organisations_controller_spec.rb | 10 ++++++---- spec/requests/schemes_controller_spec.rb | 9 ++++++--- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 30f2715fc..fbc8aa336 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -61,11 +61,11 @@ RSpec.describe OrganisationsController, type: :request do describe "scheme and location csv downloads" do let!(:specific_organisation) { create(:organisation) } - let(:specific_org_schemes) { create_list(:scheme, 5, owning_organisation: specific_organisation) } let!(:specific_org_scheme) { create(:scheme, owning_organisation: specific_organisation) } - let(:specific_org_locations) { create_list(:location, 3, scheme: specific_org_scheme) } before do + create_list(:scheme, 5, owning_organisation: specific_organisation) + create_list(:location, 3, scheme: specific_org_scheme) get "/organisations/#{specific_organisation.id}/schemes", headers:, params: {} end @@ -177,8 +177,10 @@ RSpec.describe OrganisationsController, type: :request do end describe "scheme and location csv downloads" do - let(:same_org_schemes) { create_list(:scheme, 5, owning_organisation: user.organisation) } - let(:same_org_locations) { create_list(:location, 3, scheme: same_org_scheme) } + before do + create_list(:scheme, 5, owning_organisation: user.organisation) + create_list(:location, 3, scheme: same_org_scheme) + end it "shows scheme and location download links" do expect(page).to have_link("Download schemes (CSV)", href: csv_download_schemes_path(download_type: "schemes")) diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index b6280d536..929fe7db8 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -193,11 +193,14 @@ RSpec.describe SchemesController, type: :request do describe "scheme and location csv downloads" do let!(:same_org_scheme) { create(:scheme, owning_organisation: user.organisation) } - let(:same_org_location) { create(:location, scheme: same_org_scheme) } let!(:specific_organisation) { create(:organisation) } - let(:specific_org_schemes) { create_list(:scheme, 5, owning_organisation: specific_organisation) } let!(:specific_org_scheme) { create(:scheme, owning_organisation: specific_organisation) } - let(:specific_org_locations) { create_list(:location, 3, scheme: specific_org_scheme) } + + before do + create(:location, scheme: same_org_scheme) + create_list(:scheme, 5, owning_organisation: specific_organisation) + create_list(:location, 3, scheme: specific_org_scheme) + end it "shows scheme and location download links" do expect(page).to have_link("Download schemes (CSV)", href: csv_download_schemes_path(download_type: "schemes"))