From b41303240ad56d9317e397e8814dc756e4453b97 Mon Sep 17 00:00:00 2001 From: baarkerlounger Date: Thu, 21 Jul 2022 15:14:59 +0100 Subject: [PATCH] Switch button text when scheme exists already --- app/views/schemes/check_answers.html.erb | 3 ++- spec/features/schemes_spec.rb | 5 +++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/app/views/schemes/check_answers.html.erb b/app/views/schemes/check_answers.html.erb index 82369ea63..e84d49503 100644 --- a/app/views/schemes/check_answers.html.erb +++ b/app/views/schemes/check_answers.html.erb @@ -116,5 +116,6 @@ <%= form_for(@scheme, as: :scheme, method: :patch) do |f| %> <%= f.hidden_field :page, value: "check-answers" %> <%= f.hidden_field :confirmed, value: "true" %> - <%= f.govuk_submit "Create scheme" %> + <% button_label = @scheme.confirmed? ? "Save" : "Create scheme" %> + <%= f.govuk_submit button_label %> <% end %> diff --git a/spec/features/schemes_spec.rb b/spec/features/schemes_spec.rb index 91edcd1a2..0ad1919d6 100644 --- a/spec/features/schemes_spec.rb +++ b/spec/features/schemes_spec.rb @@ -270,6 +270,11 @@ RSpec.describe "Schemes scheme Features" do expect(page.current_url.split("/").last).to eq("check-answers#locations") expect(page).to have_content(location_name) end + + it "has the correct action button text" do + expect(page).to have_button("Save") + expect(page).not_to have_button("Create scheme") + end end end end