Browse Source

Switch button text when scheme exists already

pull/756/head
baarkerlounger 3 years ago
parent
commit
b41303240a
  1. 3
      app/views/schemes/check_answers.html.erb
  2. 5
      spec/features/schemes_spec.rb

3
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 %>

5
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

Loading…
Cancel
Save