Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Keep locale when cancelling SP-initiated signup #1662

Merged
merged 1 commit into from
Sep 8, 2017
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/decorators/service_provider_session_decorator.rb
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def sp_return_url
end

def cancel_link_path
sign_up_start_path(request_id: sp_session[:request_id])
sign_up_start_path(request_id: sp_session[:request_id], locale: locale_url_param)
Copy link
Member

Choose a reason for hiding this comment

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

Should we be doing this everywhere we're using path helpers, or is this a special case?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We may want to do this everywhere we're using path helpers? This is overridden with a default in the controller context... (see ApplicationController#default_url_options) so that means everything not inside a template or a controller we could be missing

Copy link
Member

Choose a reason for hiding this comment

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

Cool, def something to look out moving forward

end

private
Expand Down
17 changes: 13 additions & 4 deletions spec/decorators/service_provider_session_decorator_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -108,16 +108,25 @@
end

describe '#cancel_link_path' do
it 'returns sign_up_start_url with the request_id as a param' do
subject = ServiceProviderSessionDecorator.new(
subject(:decorator) do
ServiceProviderSessionDecorator.new(
sp: sp,
view_context: view_context,
sp_session: { request_id: 'foo' },
service_provider_request: ServiceProviderRequest.new
)
end

it 'returns sign_up_start_url with the request_id as a param' do
expect(decorator.cancel_link_path).to eq '/sign_up/start?request_id=foo'
end

expect(subject.cancel_link_path).
to eq '/sign_up/start?request_id=foo'
context 'in another language' do
before { I18n.locale = :fr }

it 'keeps the language' do
expect(decorator.cancel_link_path).to eq '/fr/sign_up/start?request_id=foo'
end
end
end
end