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

Redirect users to start of journey if they enter mid-way through #156

Merged
merged 6 commits into from Mar 25, 2020

Conversation

@leenagupte
Copy link
Contributor

leenagupte commented Mar 23, 2020

Trello: https://trello.com/c/bmI1RJhe

What's changed?

Adds a before_action to each controller to check that the user has at the least completed the first question.

The exemptions to this are the first question itself, and the privacy page, because users should be able to ready the privacy policy before proceeding.

Why?

If a user comes in part way through, e.g. https://coronavirus-vulnerable-people.service.gov.uk/nhs-number, they answer that question then get redirected to the first question only at the "check your answers" page. We should redirect them to the first question earlier on so that they don't have to repeat part of their journey.

@theseanything theseanything force-pushed the route-to-first-question branch from f92c5b7 to 634ae67 Mar 25, 2020
@theseanything theseanything dismissed their stale review Mar 25, 2020

Error with confirmation page

When I visit the basic care needs page
Then I can see the basic_care_needs page content
And I can see the basic_care_needs radio button options
Scenario: Visits the live in England page

This comment has been minimized.

Copy link
@huwd

huwd Mar 25, 2020

Contributor

Do we have a feature test for the redirect?

Perhaps something like:

Scenario: Lands half way through the form
  Given: I have not answered the live_in_england question
  When: I land on the NHS letter page
  Then: I am redirected to the live_in_england page
  And: I can see the live_in_england page content
Copy link
Contributor

huwd left a comment

Might need another couple of test cases?

@theseanything

This comment has been minimized.

Copy link
Contributor

theseanything commented Mar 25, 2020

Might need another couple of test cases?

Done added a feature test and a controller test for the privacy page.

@huwd
huwd approved these changes Mar 25, 2020
@issyl0

This comment has been minimized.

Copy link
Member

issyl0 commented Mar 25, 2020

Needs a rebase.

leenagupte and others added 6 commits Mar 23, 2020
If a user comes in part way through,
e.g. https://coronavirus-vulnerable-people.service.gov.uk/nhs-number,
they answer that question then get redirected to the first question only
at the "check your answers" page. We should redirect them to the first
question earlier on so that they don't have to repeat part of their
journey.

Also adds an empty `show` method to the ApplicationController to fix
this lint error:

```
app/controllers/application_controller.rb:4:3: C: Rails/LexicallyScopedActionFilter: show is not explicitly defined on the class. (https://rails.rubystyle.guide#lexically-scoped-action-filter)
  before_action :check_first_question, only: [:show]
```
We can't access the session in feature tests, so that means we can't set a value for
`sessions[:live_in_england]` and allow the test to skip straight to the basic needs page.

The proper thing to do would be to add a step for every page, but as we're using this more as
a smoke test, I've changed the the test to start at the beginning of the journey.
@theseanything theseanything force-pushed the route-to-first-question branch from e7190b8 to 5357420 Mar 25, 2020
@theseanything theseanything merged commit 0cab106 into master Mar 25, 2020
2 checks passed
2 checks passed
Travis CI - Branch Build Passed
Details
Travis CI - Pull Request Build Passed
Details
@theseanything theseanything deleted the route-to-first-question branch Mar 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

None yet

4 participants
You can’t perform that action at this time.