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| %>
<%= 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 %>
<% 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:
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
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
expect(page).to have_content("These 2 sets of locations might have duplicates")
end
it "has page heading" do
expect(page).to have_content("Review these sets of schemes and locations")
end
end
context "without duplicate schemes and locations" do
@ -414,12 +414,12 @@ RSpec.describe OrganisationsController, type: :request do
before do
sign_in user
create_list(:scheme, 5, :duplicate)
create_list(:scheme, 5, :duplicate, owning_organisation: organisation)
get "/organisations/#{organisation.id}/schemes/duplicates", headers:
end
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

Loading…
Cancel
Save