add spec
This commit is contained in:
@@ -72,6 +72,61 @@ feature 'User managing appearance releases' do
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
|
||||
scenario 'creating a release for a minor with two guardians', js: true do
|
||||
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
|
||||
|
||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_appearance_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).to have_photo_button
|
||||
expect(page).not_to have_content('SECOND GUARDIAN INFORMATION')
|
||||
expect(page).not_to have_content('SECOND GUARDIAN PHOTO')
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
expect(page).to have_content('GUARDIAN INFORMATION')
|
||||
expect(page).to have_content('GUARDIAN PHOTO')
|
||||
expect(page).to have_content 'Guardian Email'
|
||||
|
||||
expect(page).to have_content 'SECOND GUARDIAN INFORMATION'
|
||||
expect(page).to have_content 'SECOND GUARDIAN PHOTO'
|
||||
expect(page).to have_content 'Second Guardian Email'
|
||||
expect(page).to have_content 'Second Guardian Phone'
|
||||
expect(page).to have_content 'Second Guardian Address'
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
fill_in guardian_phone_field, with: '001101'
|
||||
fill_in person_first_name_field, with: 'Jane'
|
||||
fill_in person_last_name_field, with: 'Doe'
|
||||
fill_in_person_address_fields
|
||||
fill_in person_phone_field, with: '555-555-5555'
|
||||
fill_in person_email_field, with: 'jane.doe@test.com'
|
||||
fill_in person_date_of_birth, with: '01/01/1999'
|
||||
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
|
||||
fill_in guardian_email_field, with: 'invalid@email'
|
||||
click_button submit_release_button
|
||||
expect(page).to have_content('Guardian email is not an email')
|
||||
|
||||
fill_in guardian_email_field, with: 'valid@email.com'
|
||||
fill_in_guardian_address_fields
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
|
||||
fill_in guardian_2_first_name_field, with: 'Second'
|
||||
fill_in guardian_2_last_name_field, with: 'Guardian'
|
||||
fill_in guardian_2_phone_field, with: '999'
|
||||
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
expect(AppearanceRelease.last.guardian_2_first_name).to eq 'Second'
|
||||
end
|
||||
end
|
||||
|
||||
context 'when signed in' do
|
||||
@@ -454,6 +509,18 @@ feature 'User managing appearance releases' do
|
||||
'appearance_release_minor'
|
||||
end
|
||||
|
||||
def guardian_2_first_name_field
|
||||
'Second guardian first name'
|
||||
end
|
||||
|
||||
def guardian_2_last_name_field
|
||||
'Second guardian last name'
|
||||
end
|
||||
|
||||
def guardian_2_phone_field
|
||||
'Second guardian phone'
|
||||
end
|
||||
|
||||
def guardian_first_name_field
|
||||
'Guardian first name'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user