Browse Source

checking the back functionality for returning from support page

pull/671/head
JG 3 years ago
parent
commit
8ac63d627a
  1. 7
      app/views/schemes/check_answers.html.erb
  2. 2
      app/views/schemes/support.html.erb
  3. 18
      spec/features/schemes_spec.rb

7
app/views/schemes/check_answers.html.erb

@ -1,12 +1,5 @@
<% content_for :title, "Check your answers before creating this scheme" %> <% content_for :title, "Check your answers before creating this scheme" %>
<% content_for :before_content do %>
<%= govuk_back_link(
text: "Back",
href: "/schemes/#{@scheme.id}/support",
) %>
<% end %>
<%= render partial: "organisations/headings", locals: { main: "Check your changes before updating this scheme", sub: @scheme.service_name } %> <%= render partial: "organisations/headings", locals: { main: "Check your changes before updating this scheme", sub: @scheme.service_name } %>
<%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %> <%= govuk_tabs(title: "Check your answers before creating this scheme") do |component| %>

2
app/views/schemes/support.html.erb

@ -3,7 +3,7 @@
<% content_for :before_content do %> <% content_for :before_content do %>
<%= govuk_back_link( <%= govuk_back_link(
text: "Back", text: "Back",
href: "/schemes/#{@scheme.id}/secondary-client-group", href: request.query_parameters["check_answers"] ? "/schemes/#{@scheme.id}/check-answers" : "/schemes/#{@scheme.id}/secondary-client-group",
) %> ) %>
<% end %> <% end %>

18
spec/features/schemes_spec.rb

@ -500,10 +500,14 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "Check your changes before updating this scheme" expect(page).to have_content "Check your changes before updating this scheme"
end end
end end
end
context "changing support questions" do
before do
click_link("Change", href: "/schemes/#{scheme.id}/support?check_answers=true", match: :first)
end end
it "allows changing support questions" do it "allows changing support questions" do
click_link("Change", href: "/schemes/#{scheme.id}/support?check_answers=true", match: :first)
expect(page).to have_current_path("/schemes/#{scheme.id}/support?check_answers=true") expect(page).to have_current_path("/schemes/#{scheme.id}/support?check_answers=true")
choose "Resettlement support" choose "Resettlement support"
@ -514,6 +518,18 @@ RSpec.describe "Schemes scheme Features" do
expect(page).to have_content "Resettlement support" expect(page).to have_content "Resettlement support"
expect(page).to have_content "Medium stay" expect(page).to have_content "Medium stay"
end end
context "when I press the back button" do
before do
click_link "Back"
end
it "lets me select the support answers" do
expect(page).to have_current_path("/schemes/#{scheme.id}/check-answers")
expect(page).to have_content "Check your changes before updating this scheme"
end
end
end
end end
end end
end end

Loading…
Cancel
Save