diff --git a/app/views/merge/organisations.html.erb b/app/views/merge/organisations.html.erb
index d5b57c4fa..f187f16fb 100644
--- a/app/views/merge/organisations.html.erb
+++ b/app/views/merge/organisations.html.erb
@@ -1,12 +1,12 @@
<% title = "Tell us if your organisation is merging" %>
<% content_for :title, title %>
-<%= govuk_back_link href: organisation_path %>
+<%= govuk_back_link href: merge_start_organisation_path %>
-
Start typing to search for your managing agent
+
Which organisations are merging?
<%= form_with model: @merge, url: merge_organisations_organisation_path, method: :patch do |f| %>
<%= f.govuk_error_summary %>
@@ -35,7 +35,10 @@
<% end %>
<% end %>
<% end %>
+ <%= govuk_details(summary_text: "Can't find the managing agent you're looking for?") do %>
+
List other organisations that are part of the merge but not registered on CORE.
+ <% end %>
<% end %>
-<%= govuk_button_link_to "Continue", merge_organisations_organisation_path, button: true %>
+<%= govuk_button_link_to "Continue", "#", button: true %>
diff --git a/spec/requests/organisations_controller_spec.rb b/spec/requests/organisations_controller_spec.rb
index 0eef27740..c62a2d115 100644
--- a/spec/requests/organisations_controller_spec.rb
+++ b/spec/requests/organisations_controller_spec.rb
@@ -443,20 +443,62 @@ RSpec.describe OrganisationsController, type: :request do
describe "#merge" do
context "with an organisation that the user belongs to" do
- before do
- get "/organisations/#{organisation.id}/merge/start", headers:, params: {}
- end
+ context "when on the start merge page" do
+ before do
+ get "/organisations/#{organisation.id}/merge/start", headers:, params: {}
+ end
- it "shows the correct content" do
- expect(page).to have_content("Tell us if your organisation is merging")
- end
+ it "shows the correct content" do
+ expect(page).to have_content("Tell us if your organisation is merging")
+ end
- it "has a correct back link" do
- expect(page).to have_link("Back", href: "/organisations/#{organisation.id}")
+ it "has a correct back link" do
+ expect(page).to have_link("Back", href: "/organisations/#{organisation.id}")
+ end
+
+ it "has a correct start now button" do
+ expect(page).to have_link("Start now", href: "/organisations/#{organisation.id}/merge/organisations")
+ end
end
- it "has a correct start now button" do
- expect(page).to have_link("Start now", href: "/organisations/#{organisation.id}/merge/organisations")
+ context "when on the merging organisations page" do
+ let(:params) { {} }
+
+ before do
+ organisation.update!(name: "Name 1")
+ unauthorised_organisation.update!(name: "Name 2")
+ get "/organisations/#{organisation.id}/merge/organisations", headers:, params:
+ end
+
+ it "shows the correct content" do
+ expect(page).to have_content("Which organisations are merging?")
+ end
+
+ it "has a correct back link" do
+ expect(page).to have_link("Back", href: "/organisations/#{organisation.id}/merge/start")
+ end
+
+ it "has a correct Continue button" do
+ expect(page).to have_link("Continue", href: "#")
+ end
+
+ context "and the page is loaded for the first time" do
+ let(:params) { { merge: { merging_organisation: nil } } }
+
+ it "shows current organisation in the list of merging organisations" do
+ expect(page).to have_css("table tr", text: organisation.name)
+ expect(page).not_to have_css("table tr", text: unauthorised_organisation.name)
+ end
+ end
+
+ context "and the page is loaded after adding a new merging organisation" do
+ let(:params) { { merge: { merging_organisations: organisation.id, merging_organisation: unauthorised_organisation.id } } }
+
+ it "shows current organisation and added organisation in the list of merging organisations" do
+ expect(page).to have_css("table tr", text: organisation.name)
+ expect(page).to have_css("table tr", text: unauthorised_organisation.name)
+ end
+ end
end
end