Browse Source

Make title dynamic

pull/2655/head
Kat 2 years ago
parent
commit
aec8774726
  1. 11
      app/views/organisations/duplicate_schemes.html.erb
  2. 12
      spec/requests/organisations_controller_spec.rb

11
app/views/organisations/duplicate_schemes.html.erb

@ -4,7 +4,16 @@
<%= form_with model: @organisation, url: schemes_duplicates_organisation_path(@organisation), method: "post" do |f| %> <%= form_with model: @organisation, url: schemes_duplicates_organisation_path(@organisation), method: "post" do |f| %>
<%= f.govuk_error_summary %> <%= f.govuk_error_summary %>
<% title = "Review these sets of schemes and locations" %> <% if @duplicate_schemes.any? %>
<% if @duplicate_locations.any? %>
<% title = "Review these sets of schemes and locations" %>
<% else %>
<% title = "Review these sets of schemes" %>
<% end %>
<% else %>
<% title = "Review these sets of locations" %>
<% end %>
<% content_for :title, title %> <% content_for :title, title %>
<% if current_user.support? %> <% if current_user.support? %>

12
spec/requests/organisations_controller_spec.rb

@ -376,10 +376,6 @@ RSpec.describe OrganisationsController, type: :request do
get "/organisations/#{organisation.id}/schemes/duplicates", headers: get "/organisations/#{organisation.id}/schemes/duplicates", headers:
end end
it "has page heading" do
expect(page).to have_content("Review these sets of schemes and locations")
end
context "with duplicate schemes and locations" do context "with duplicate schemes and locations" do
let(:schemes) { create_list(:scheme, 5, :duplicate, owning_organisation: organisation) } let(:schemes) { create_list(:scheme, 5, :duplicate, owning_organisation: organisation) }
@ -396,6 +392,10 @@ RSpec.describe OrganisationsController, type: :request do
it "displays the duplicate locations" do it "displays the duplicate locations" do
expect(page).to have_content("These 2 sets of locations might have duplicates") expect(page).to have_content("These 2 sets of locations might have duplicates")
end end
it "has page heading" do
expect(page).to have_content("Review these sets of schemes and locations")
end
end end
context "without duplicate schemes and locations" do context "without duplicate schemes and locations" do
@ -414,12 +414,12 @@ RSpec.describe OrganisationsController, type: :request do
before do before do
sign_in user sign_in user
create_list(:scheme, 5, :duplicate) create_list(:scheme, 5, :duplicate, owning_organisation: organisation)
get "/organisations/#{organisation.id}/schemes/duplicates", headers: get "/organisations/#{organisation.id}/schemes/duplicates", headers:
end end
it "has page heading" do it "has page heading" do
expect(page).to have_content("Review these sets of schemes and locations") expect(page).to have_content("Review these sets of schemes")
end end
end end

Loading…
Cancel
Save