diff --git a/spec/features/user_spec.rb b/spec/features/user_spec.rb index 8490833d8..c7495fd30 100644 --- a/spec/features/user_spec.rb +++ b/spec/features/user_spec.rb @@ -584,6 +584,7 @@ RSpec.describe "User Features" do it "they can click on an organisation to see their logs page" do visit("/organisations") click_link("Test3") + expect(page).to have_content("1 total logs") expect(page).to have_selector("a", text: "#{case_log.id}") visit("/organisations") click_link("Test5") diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index f9e164b38..8a005d6a9 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -2,7 +2,7 @@ require "rails_helper" RSpec.describe OrganisationsController, type: :request do let(:organisation) { user.organisation } - let(:unauthorised_organisation) { FactoryBot.create(:organisation) } + let!(:unauthorised_organisation) { FactoryBot.create(:organisation) } let(:headers) { { "Accept" => "text/html" } } let(:page) { Capybara::Node::Simple.new(response.body) } let(:user) { FactoryBot.create(:user, :data_coordinator) } @@ -299,5 +299,17 @@ RSpec.describe OrganisationsController, type: :request do end end end + + context "with a data provider 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") + end + end end end