Browse Source

spec to test we are at correct sub menu for Users

pull/627/head
JG 3 years ago
parent
commit
093bcd220c
  1. 21
      spec/features/organisation_spec.rb

21
spec/features/organisation_spec.rb

@ -166,7 +166,7 @@ RSpec.describe "User Features" do
context "when I search for users belonging to a specific organisation" do context "when I search for users belonging to a specific organisation" do
context "when I am signed in and there are users in the database" do context "when I am signed in and there are users in the database" do
let!(:user_list) { FactoryBot.create_list(:user, 4, organisation: organisation) } let!(:user_list) { FactoryBot.create_list(:user, 4, organisation: user.organisation) }
context "when I visit the organisation page" do context "when I visit the organisation page" do
before do before do
@ -176,6 +176,25 @@ RSpec.describe "User Features" do
it "has link to the organisations users tab" do it "has link to the organisations users tab" do
expect(page).to have_link("Users", href: "/organisations/#{org_id}/users") expect(page).to have_link("Users", href: "/organisations/#{org_id}/users")
end end
context "I click users link in submenu" do
before do
click_link("Users", href: "/organisations/#{org_id}/users")
end
it "shows list of users belonging to the same organisation" do
user_list.each do |user|
expect(page).to have_content(user.email)
end
end
it "shows submenu for selected orgnisation" do
expect(page).to have_css('[aria-current="page"]', text: "Users")
expect(page).to have_current_path("/organisations/#{org_id}/users")
expect(page).to have_link("Logs")
expect(page).to have_link("About your organisation")
end
end
end end
end end
end end

Loading…
Cancel
Save