-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Interrupt the candidate post-offer when adding a reference
If a candidate has accepted an offer, they can add another reference. If they add one with a personal email address, they should be interrupted.
- Loading branch information
Showing
2 changed files
with
159 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
150 changes: 150 additions & 0 deletions
150
...erface/references/candidate_adds_reference_with_personal_email_address_post_offer_spec.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,150 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'Creating references with personal email addresses after an offer has been accepted' do | ||
include CandidateHelper | ||
|
||
scenario 'Candidate adds a new reference and see personal email address interruption' do | ||
given_i_am_signed_in | ||
and_i_have_an_accepted_offer | ||
and_i_navigate_to_add_another_reference | ||
and_i_complete_some_reference_details | ||
|
||
when_i_provide_an_email_that_appears_to_be_personal | ||
then_i_see_the_interruption | ||
|
||
when_i_click_go_back_and_change | ||
and_i_provide_a_work_email_address | ||
then_i_see_the_relationship_page_not_the_interruption | ||
|
||
when_i_complete_my_references_details | ||
then_i_see_my_reference_with_professional_email_address | ||
end | ||
|
||
scenario 'Candidate saves a new reference and with personal email address' do | ||
given_i_am_signed_in | ||
and_i_have_an_accepted_offer | ||
and_i_navigate_to_add_another_reference | ||
and_i_complete_some_reference_details | ||
when_i_provide_an_email_that_appears_to_be_personal | ||
then_i_see_the_interruption | ||
|
||
when_i_choose_to_continue_with_the_personal_email_address | ||
then_i_see_the_relationship_page_not_the_interruption | ||
|
||
when_i_complete_my_references_details | ||
then_i_see_my_reference_with_personal_email_address | ||
end | ||
|
||
scenario 'Candidate changes personal email address at interruption with back buttons' do | ||
given_i_am_signed_in | ||
and_i_have_an_accepted_offer | ||
and_i_navigate_to_add_another_reference | ||
and_i_complete_some_reference_details | ||
when_i_provide_an_email_that_appears_to_be_personal | ||
then_i_see_the_interruption | ||
|
||
when_i_click_back | ||
and_i_provide_a_work_email_address | ||
then_i_see_the_relationship_page_not_the_interruption | ||
|
||
when_i_complete_my_references_details | ||
then_i_see_my_reference_with_professional_email_address | ||
end | ||
|
||
private | ||
|
||
def given_i_am_signed_in | ||
@candidate = create(:candidate) | ||
login_as(@candidate) | ||
@application_form = create(:completed_application_form, candidate: @candidate) | ||
end | ||
|
||
def and_i_have_an_accepted_offer | ||
@application_form = create(:completed_application_form, candidate: @candidate) | ||
@pending_reference = create(:reference, :feedback_requested, reminder_sent_at: nil, application_form: @application_form) | ||
@completed_reference = create(:reference, :feedback_provided, application_form: @application_form) | ||
|
||
@application_choice = create( | ||
:application_choice, | ||
:accepted, | ||
application_form: @application_form, | ||
) | ||
end | ||
|
||
def and_i_navigate_to_add_another_reference | ||
visit root_path | ||
click_on 'Request another reference' | ||
click_on 'Continue' | ||
end | ||
|
||
def and_i_complete_some_reference_details | ||
choose 'Academic, such as a university tutor' | ||
click_on 'Continue' | ||
fill_in 'What’s the name of the person who can give a reference?', with: 'Walter White' | ||
click_on 'Save and continue' | ||
end | ||
|
||
def when_i_click_add_reference | ||
click_on 'Add reference' | ||
end | ||
|
||
def when_i_provide_an_email_that_appears_to_be_personal | ||
fill_in 'What is Walter White’s email address?', with: '[email protected]' | ||
click_on 'Save and continue' | ||
end | ||
|
||
def and_i_provide_a_work_email_address | ||
fill_in 'What is Walter White’s email address?', with: '[email protected]' | ||
end | ||
|
||
def when_i_click_go_back_and_change | ||
click_on 'Go back and change the email address' | ||
end | ||
|
||
def when_i_click_back | ||
click_on 'Back' | ||
end | ||
|
||
def then_i_see_the_interruption | ||
expect(page).to have_content '[email protected] looks like a personal email address' | ||
expect(page).to have_content 'You should ask Walter White if they have a work email address you can use instead and update your application.' | ||
end | ||
|
||
def then_i_see_the_relationship_page_not_the_interruption | ||
expect(page).to have_current_path candidate_interface_request_reference_references_relationship_path(@application_form.application_references.creation_order.last.id) | ||
expect(page).to have_content 'How do you know Walter White and how long have you known them?' | ||
expect(page).to have_no_content 'You should ask Walter White if they have a work email address you can use instead and update your application.' | ||
end | ||
|
||
def when_i_choose_to_continue_with_the_personal_email_address | ||
click_on 'Save and continue' | ||
end | ||
|
||
def when_i_complete_my_references_details | ||
fill_in 'How do you know Walter White and how long have you known them?', with: 'They were my course supervisor.' | ||
click_on 'Save and continue' | ||
end | ||
|
||
def and_i_provide_a_work_email_address | ||
fill_in 'What is Walter White’s email address?', with: '[email protected]' | ||
click_on 'Save and continue' | ||
end | ||
|
||
def then_i_see_my_reference_with_professional_email_address | ||
expect(page).to have_content('Academic, such as a university tutor') | ||
expect(page).to have_content('Walter White') | ||
expect(page).to have_content('[email protected]') | ||
expect(page).to have_content('They were my course supervisor.') | ||
end | ||
|
||
def then_i_see_my_reference_with_personal_email_address | ||
expect(page).to have_content('Academic, such as a university tutor') | ||
expect(page).to have_content('Walter White') | ||
expect(page).to have_content('[email protected]') | ||
expect(page).to have_content('They were my course supervisor.') | ||
end | ||
|
||
def and_i_click_request_another_reference | ||
click_on 'Request another reference' | ||
end | ||
end |