diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 686b5e847..66040ed52 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -133,8 +133,8 @@ RSpec.describe "Schemes scheme Features" do context "when there are locations that belong to the selected scheme" do let!(:schemes) { FactoryBot.create_list(:scheme, 5) } - let!(:locations) { FactoryBot.create_list(:location, 3, scheme: scheme) } let(:scheme) { schemes.first } + let!(:locations) { FactoryBot.create_list(:location, 3, scheme: scheme) } before do visit("schemes") diff --git a/spec/requests/schemes_controller_spec.rb b/spec/requests/schemes_controller_spec.rb index 439d12a02..a8a705dd4 100644 --- a/spec/requests/schemes_controller_spec.rb +++ b/spec/requests/schemes_controller_spec.rb @@ -270,5 +270,20 @@ RSpec.describe SchemesController, type: :request do expect(response).to have_http_status(:unauthorized) end end + + context "when signed in as a data coordinator user" do + let(:user) { FactoryBot.create(:user, :data_coordinator) } + let!(:scheme) { FactoryBot.create(:scheme, organisation: user.organisation) } + let!(:location) { FactoryBot.create(:location, scheme: scheme) } + + before do + sign_in user + get "/schemes/#{scheme.id}/locations" + end + + it "shows scheme" do + expect(page).to have_content(location.location_code) + end + end end end