diff --git a/app/views/organisation_relationships/add_managing_agent.html.erb b/app/views/organisation_relationships/add_managing_agent.html.erb
index 173e845ad..8f53b1eeb 100644
--- a/app/views/organisation_relationships/add_managing_agent.html.erb
+++ b/app/views/organisation_relationships/add_managing_agent.html.erb
@@ -22,7 +22,10 @@
question: Form::Question.new("", { "answer_options" => answer_options }, nil),
f:,
} %>
- <%= f.govuk_submit "Add" %>
+
+ <%= f.govuk_submit "Add" %>
+ <%= govuk_button_link_to("Cancel", managing_agents_organisation_path(@organisation), secondary: true) %>
+
<%= govuk_details(summary_text: "Can't find the managing agent you're looking for?") do %>
- Double check the spelling and try again
diff --git a/app/views/organisation_relationships/add_stock_owner.html.erb b/app/views/organisation_relationships/add_stock_owner.html.erb
index e78e81b8a..f531eb7f7 100644
--- a/app/views/organisation_relationships/add_stock_owner.html.erb
+++ b/app/views/organisation_relationships/add_stock_owner.html.erb
@@ -22,7 +22,10 @@
question: Form::Question.new("", { "answer_options" => answer_options }, nil),
f:,
} %>
- <%= f.govuk_submit "Add" %>
+
+ <%= f.govuk_submit "Add" %>
+ <%= govuk_button_link_to("Cancel", stock_owners_organisation_path(@organisation), secondary: true) %>
+
<%= govuk_details(summary_text: "Can't find the stock owner you're looking for?") do %>
- Double check the spelling and try again
diff --git a/spec/requests/organisation_relationships_controller_spec.rb b/spec/requests/organisation_relationships_controller_spec.rb
index 78b894b7f..a93e77d76 100644
--- a/spec/requests/organisation_relationships_controller_spec.rb
+++ b/spec/requests/organisation_relationships_controller_spec.rb
@@ -62,6 +62,10 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows an add button" do
expect(page).to have_button("Add")
end
+
+ it "shows a cancel button" do
+ expect(page).to have_link("Cancel", href: "/organisations/#{organisation.id}/stock-owners")
+ end
end
end
@@ -640,7 +644,7 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
expect(response.body).to include("Remove")
end
- context "when adding a stock owner" do
+ context "when adding a managing agent" do
before do
get "/organisations/#{organisation.id}/managing-agents/add", headers:, params: {}
end
@@ -652,6 +656,10 @@ RSpec.describe OrganisationRelationshipsController, type: :request do
it "shows an add button" do
expect(page).to have_button("Add")
end
+
+ it "shows a cancel button" do
+ expect(page).to have_link("Cancel", href: "/organisations/#{organisation.id}/managing-agents")
+ end
end
end
end