From c8adc8f67c66dc1efe03d895920fa1b7b0c4c29e Mon Sep 17 00:00:00 2001 From: Kat Date: Wed, 18 May 2022 12:45:18 +0100 Subject: [PATCH] Update a organisation page test and lint --- spec/features/user_spec.rb | 4 ++-- spec/requests/organisations_controller_spec.rb | 6 +++++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index c7495fd30..166f67f25 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -585,10 +585,10 @@ RSpec.describe "User Features" do visit("/organisations") click_link("Test3") expect(page).to have_content("1 total logs") - expect(page).to have_selector("a", text: "#{case_log.id}") + expect(page).to have_selector("a", text: case_log.id.to_s) visit("/organisations") click_link("Test5") - expect(page).not_to have_selector("a", text: "#{case_log.id}") + expect(page).not_to have_selector("a", text: case_log.id.to_s) end end end diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 8a005d6a9..0e5eb4a19 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -300,15 +300,19 @@ RSpec.describe OrganisationsController, type: :request do end end - context "with a data provider user" do + context "with a support user" do let(:user) { FactoryBot.create(:user, :support) } + before do allow(user).to receive(:need_two_factor_authentication?).and_return(false) sign_in user get "/organisations" end + it "shows all organisations" do expect(page).to have_content("2 total organisations") + expect(page).to have_link organisation.name, href: "organisations/#{organisation.id}/logs" + expect(page).to have_link unauthorised_organisation.name, href: "organisations/#{unauthorised_organisation.id}/logs" end end end