From e23860134897a8c1d970cdca927d535b8ee5602e Mon Sep 17 00:00:00 2001 From: JG Date: Tue, 31 May 2022 15:45:33 +0100 Subject: [PATCH] testing users inside org --- .../requests/organisations_controller_spec.rb | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb index 1039beb49..2cc6a463c 100644 --- a/spec/requests/organisations_controller_spec.rb +++ b/spec/requests/organisations_controller_spec.rb @@ -519,6 +519,76 @@ RSpec.describe OrganisationsController, type: :request do end end + + + + + + + + + + + + + + + + + + + + + + + + + + context "when viewing a specific organisation users" do + let!(:users) { FactoryBot.create_list(:user, 5, organisation: user.organisation) } + + before do + get "/organisations/#{organisation.id}/users", headers:, params: {} + end + + it "displays the name of the organisation" do + expect(page).to have_content(organisation.name) + end + + it "has a sub-navigation with correct tabs" do + expect(page).to have_css(".app-sub-navigation") + expect(page).to have_content("Users") + end + + it "returns all users" do + expect(page).to have_content(user.email) + users.each do |user| + expect(page).to have_content(user.email) + end + end + end + + + + + + + + + + + + + + + + + + + + + + context "when viewing a specific organisation details" do before do get "/organisations/#{organisation.id}/details", headers:, params: {}