Browse Source

add tests

pull/557/head
Ted 3 years ago committed by Kat
parent
commit
4a0c1ac214
  1. 2
      app/views/organisations/_organisation_list.html.erb
  2. 23
      spec/features/user_spec.rb

2
app/views/organisations/_organisation_list.html.erb

@ -1,5 +1,5 @@
<section class="app-table-group" tabindex="0" aria-labelledby="<%= title.dasherize %>"> <section class="app-table-group" tabindex="0" aria-labelledby="<%= title.dasherize %>">
<table class="govuk-table"> <table id="all-organisations-table" class="govuk-table">
<caption id="<%= title.dasherize %>" class="govuk-!-text-align-left govuk-!-margin-top-4 govuk-!-margin-bottom-4"> <caption id="<%= title.dasherize %>" class="govuk-!-text-align-left govuk-!-margin-top-4 govuk-!-margin-bottom-4">
<span class="govuk-!-margin-right-4"> <span class="govuk-!-margin-right-4">
<strong><%= pagy.count %></strong> total <%= title.downcase %> <strong><%= pagy.count %></strong> total <%= title.downcase %>

23
spec/features/user_spec.rb

@ -549,5 +549,28 @@ RSpec.describe "User Features" do
end end
end end
end end
context "when the user is logged in as a support user" do
let!(:support_user) { FactoryBot.create(:user, :support) }
before do
allow(SecureRandom).to receive(:random_number).and_return(otp)
visit("/logs")
fill_in("user[email]", with: support_user.email)
fill_in("user[password]", with: "pAssword1")
click_button("Sign in")
fill_in("code", with: otp)
click_button("Submit")
end
it "they should see organisations instead of your organisations in the navigation bar" do
visit("/organisations")
expect(page).to have_selector("h1", text: "Organisations")
end
it "they should see all organisations listed in the organisations page" do
visit("/organisations")
expect(page).to have_css('#all-organisations-table')
end
end
end end
end end

Loading…
Cancel
Save