Skip to content

Commit

Permalink
store EY start email for back scenario works
Browse files Browse the repository at this point in the history
  • Loading branch information
asmega committed Oct 1, 2024
1 parent c611caf commit 162d8a4
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ class FindReferenceForm < Form
def save
return false if invalid?

journey_session.answers.assign_attributes(reference_number:)
journey_session.answers.assign_attributes(
reference_number:,
start_email: email
)
journey_session.save!
end

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ module EarlyYearsPayment
module Practitioner
class SessionAnswers < Journeys::SessionAnswers
attribute :reference_number, :string
attribute :start_email, :string

def policy
Policies::EarlyYearsPayments
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<%= form_with model: @form, url: claim_path(current_journey_routing_name, request.query_parameters), method: :patch, builder: GOVUKDesignSystemFormBuilder::FormBuilder, html: { novalidate: false } do |f| %>
<%= f.govuk_error_summary %>

<%= f.hidden_field :email, value: params[:email] %>
<%= f.hidden_field :email, value: (params[:email] || journey_session.answers.attributes["start_email"]) %>

<h1 class="govuk-heading-l">
<%= @form.t(:question) %>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,5 +34,11 @@
click_button "Submit"

expect(page).to have_content "Sign in with GOV.UK One Login"
click_link "Back"

expect(page).to have_content "Track your application"
fill_in "Claim reference number", with: claim.reference
click_button "Submit"
expect(page).to have_content "Sign in with GOV.UK One Login"
end
end

0 comments on commit 162d8a4

Please sign in to comment.