Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion app/controllers/idv/agreement_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ def skip_to_capture
end

def consent_form_params
params.require(:doc_auth).permit(:ial2_consent_given)
params.require(:doc_auth).permit([:ial2_consent_given, :idv_consent_given])
end

def confirm_welcome_step_complete
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/idv/getting_started_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def skip_to_capture
end

def consent_form_params
params.require(:doc_auth).permit(:ial2_consent_given)
params.require(:doc_auth).permit([:ial2_consent_given, :idv_consent_given])
end

def confirm_agreement_needed
Expand Down
8 changes: 4 additions & 4 deletions app/forms/idv/consent_form.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,17 @@ module Idv
class ConsentForm
include ActiveModel::Model

validates :ial2_consent_given?,
validates :idv_consent_given?,
acceptance: { message: proc { I18n.t('errors.doc_auth.consent_form') } }

def submit(params)
@ial2_consent_given = params[:ial2_consent_given] == '1'
@idv_consent_given = params[:idv_consent_given] == '1' || params[:ial2_consent_given] == '1'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Personally I'd go for one of these

Suggested change
@idv_consent_given = params[:idv_consent_given] == '1' || params[:ial2_consent_given] == '1'
@idv_consent_given = (params[:idv_consent_given] || params[:ial2_consent_given]) == '1'


FormResponse.new(success: valid?, errors: errors)
end

def ial2_consent_given?
@ial2_consent_given
def idv_consent_given?
@idv_consent_given
end
end
end
17 changes: 16 additions & 1 deletion spec/controllers/idv/agreement_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@
let(:params) do
{
doc_auth: {
ial2_consent_given: 1,
idv_consent_given: 1,
},
skip_hybrid_handoff: skip_hybrid_handoff,
}.compact
Expand Down Expand Up @@ -146,5 +146,20 @@
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end

context 'ial2_consent_given param present' do
let(:params) do
{
doc_auth: {
ial2_consent_given: 1,
},
skip_hybrid_handoff: skip_hybrid_handoff,
}.compact
end
it 'succeeds' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end
end
end
17 changes: 16 additions & 1 deletion spec/controllers/idv/getting_started_controller_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@
let(:params) do
{
doc_auth: {
ial2_consent_given: 1,
idv_consent_given: 1,
},
skip_hybrid_handoff: skip_hybrid_handoff,
}.compact
Expand Down Expand Up @@ -156,6 +156,21 @@
expect(response).to redirect_to(idv_hybrid_handoff_url)
end

context 'ial2_consent_given param present' do
let(:params) do
{
doc_auth: {
ial2_consent_given: 1,
},
skip_hybrid_handoff: skip_hybrid_handoff,
}.compact
end
it 'succeeds' do
put :update, params: params
expect(response).to redirect_to(idv_hybrid_handoff_url)
end
end

context 'skip_hybrid_handoff present in params' do
let(:skip_hybrid_handoff) { '' }
it 'sets flow_path to standard' do
Expand Down