update specs to test guardian email field
This commit is contained in:
@@ -33,6 +33,7 @@ FactoryBot.define do
|
||||
guardian_last_name "Doe"
|
||||
guardian_address "100 Test Lane, New York, 10001"
|
||||
guardian_phone "123-555-1234"
|
||||
guardian_email "guardian@galaxy.all"
|
||||
end
|
||||
|
||||
trait :minor_with_guardian_photo do
|
||||
@@ -41,6 +42,7 @@ FactoryBot.define do
|
||||
guardian_last_name "Doe"
|
||||
guardian_address "100 Test Lane, New York, 10001"
|
||||
guardian_phone "123-555-1234"
|
||||
guardian_email "guardian@galaxy.all"
|
||||
guardian_photo do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "pratt.jpg")
|
||||
Rack::Test::UploadedFile.new(path, "image/jpeg")
|
||||
|
||||
@@ -25,7 +25,7 @@ feature 'User managing appearance releases' do
|
||||
fill_in person_date_of_birth, with: '01/01/1999'
|
||||
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button 'I have read and agree to the above'
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
@@ -45,6 +45,7 @@ feature 'User managing appearance releases' do
|
||||
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'
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
@@ -58,7 +59,14 @@ feature 'User managing appearance releases' do
|
||||
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'
|
||||
click_button 'I have read and agree to the above'
|
||||
|
||||
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'
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
@@ -249,6 +257,7 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_body).to have_content('TAGS')
|
||||
expect(pdf_body).to have_content('Woman')
|
||||
expect(pdf_body).to have_content('Brunette')
|
||||
expect(pdf_body).not_to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'viewing contract PDF for a minor without guardian photo' do
|
||||
@@ -262,8 +271,10 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
|
||||
expect(pdf_body).to have_content(appearance_release.name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_email)
|
||||
expect(pdf_body).to have_content photos_heading.upcase
|
||||
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
|
||||
expect(pdf_body).to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'viewing contract PDF for a minor with guardian photo' do
|
||||
@@ -277,9 +288,11 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
|
||||
expect(pdf_body).to have_content(appearance_release.name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_email)
|
||||
expect(pdf_body).to have_content photos_heading(2).upcase
|
||||
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_photo.filename.to_s)
|
||||
expect(pdf_body).to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'deleting a release', js: true do
|
||||
@@ -470,6 +483,10 @@ feature 'User managing appearance releases' do
|
||||
'Guardian phone'
|
||||
end
|
||||
|
||||
def guardian_email_field
|
||||
'Guardian email'
|
||||
end
|
||||
|
||||
def guardian_photo_field
|
||||
'appearance_release[guardian_photo]'
|
||||
end
|
||||
@@ -518,6 +535,10 @@ feature 'User managing appearance releases' do
|
||||
'Import Release'
|
||||
end
|
||||
|
||||
def submit_release_button
|
||||
'I have read and agree to the above'
|
||||
end
|
||||
|
||||
def submit_update_button
|
||||
'Save Changes'
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user