Upstream sync
This commit is contained in:
@@ -160,7 +160,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
expect(content_disposition).to include('inline')
|
||||
expect(pdf_body).to have_content('PREVIEW ONLY')
|
||||
expect(pdf_body).to have_content('Acquired Media Release')
|
||||
expect(pdf_body).not_to have_content('Guardian')
|
||||
expect(pdf_body).to have_content('Guardian')
|
||||
|
||||
visit new_project_contract_template_path(project)
|
||||
select 'Location Release', from: 'Release type'
|
||||
@@ -178,7 +178,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
expect(content_disposition).to include('inline')
|
||||
expect(pdf_body).to have_content('PREVIEW ONLY')
|
||||
expect(pdf_body).to have_content('Material Release')
|
||||
expect(pdf_body).not_to have_content('Guardian')
|
||||
expect(pdf_body).to have_content('Guardian')
|
||||
end
|
||||
|
||||
context 'preventing creation of release template with wrong fee value' do
|
||||
|
||||
@@ -51,6 +51,13 @@ RSpec.feature "User manages project custom folders", type: :feature do
|
||||
|
||||
expect(page).to have_content("UPLOAD NEW FILES")
|
||||
|
||||
expect do
|
||||
click_button "Upload Files"
|
||||
end.not_to raise_exception
|
||||
|
||||
expect(page).to have_content("UPLOAD NEW FILES")
|
||||
expect(page).not_to have_content("The folder has been updated")
|
||||
|
||||
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
|
||||
|
||||
click_button "Upload Files"
|
||||
|
||||
@@ -12,7 +12,7 @@ feature "User managing acquired_media releases" do
|
||||
expect(country_field_value).to eq "US"
|
||||
end
|
||||
|
||||
scenario "creating a release", js: true do
|
||||
scenario "creating a release for an adult", js: true do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
|
||||
@@ -35,11 +35,121 @@ feature "User managing acquired_media releases" do
|
||||
draw_signature file_fixture("signature.png"), "acquired_media_release_signature_base64"
|
||||
end
|
||||
|
||||
click_button "I have read and agree to the above"
|
||||
click_button submit_release_button
|
||||
|
||||
expect(AcquiredMediaRelease.last.categories).to include("Video Footage")
|
||||
expect(AcquiredMediaRelease.last.categories).to include("Still Photograph")
|
||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
||||
expect(page).to have_content successful_submission_message
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'false'
|
||||
expect(field).not_to be_visible
|
||||
end
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'true'
|
||||
expect(field).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'creating a release for a minor', js: true do
|
||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).not_to have_content guardian_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_photo_heading.upcase
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading.upcase
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
fill_in acquired_media_name_field, with: "Jane Doe"
|
||||
acquired_media_category_fields
|
||||
fill_in acquried_media_description_field, with: "Description"
|
||||
fill_in acquried_media_owner_first_name, with: "Jane"
|
||||
fill_in acquried_media_owner_last_name, with: "Doe"
|
||||
fill_in acquired_media_person_title, with: "Ms."
|
||||
fill_in acquired_media_person_phone, with: "555-5555-5555"
|
||||
fill_in acquired_media_person_email, with: "person@example.com"
|
||||
fill_in acquired_media_person_fax, with: "FAX"
|
||||
fill_in acquired_media_person_address_street_1, with: "Street 1"
|
||||
fill_in acquired_media_person_address_city, with: "City"
|
||||
fill_in acquired_media_person_address_state, with: "State"
|
||||
fill_in acquired_media_release_person_address_zip, with: "ZIP"
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
draw_signature file_fixture("signature.png"), "acquired_media_release_signature_base64"
|
||||
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
|
||||
scenario 'creating a release for a minor with two guardians', js: true do
|
||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_acquired_media_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).not_to have_content guardian_2_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_2_photo_heading.upcase
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading.upcase
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
expect(page).to have_content guardian_2_information_heading.upcase
|
||||
expect(page).to have_content guardian_2_photo_heading.upcase
|
||||
expect(page).to have_content guardian_2_phone_field.titleize
|
||||
|
||||
fill_in acquired_media_name_field, with: "Jane Doe"
|
||||
acquired_media_category_fields
|
||||
fill_in acquried_media_description_field, with: "Description"
|
||||
fill_in acquried_media_owner_first_name, with: "Jane"
|
||||
fill_in acquried_media_owner_last_name, with: "Doe"
|
||||
fill_in acquired_media_person_title, with: "Ms."
|
||||
fill_in acquired_media_person_phone, with: "555-5555-5555"
|
||||
fill_in acquired_media_person_email, with: "person@example.com"
|
||||
fill_in acquired_media_person_fax, with: "FAX"
|
||||
fill_in acquired_media_person_address_street_1, with: "Street 1"
|
||||
fill_in acquired_media_person_address_city, with: "City"
|
||||
fill_in acquired_media_person_address_state, with: "State"
|
||||
fill_in acquired_media_release_person_address_zip, with: "ZIP"
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
draw_signature file_fixture("signature.png"), "acquired_media_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(AcquiredMediaRelease.last.guardian_2_first_name).to eq 'Second'
|
||||
end
|
||||
|
||||
scenario "creating a release, if contract template contains signature legal language, it is shown" do
|
||||
@@ -51,6 +161,106 @@ feature "User managing acquired_media releases" do
|
||||
end
|
||||
|
||||
context "when signed in" do
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "creating a release for an adult", js: true do
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
fill_in acquired_media_name_field, with: "Jane Doe"
|
||||
acquired_media_category_fields
|
||||
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
|
||||
click_button import_release_button
|
||||
|
||||
expect(page).to have_content successful_import_message
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'false'
|
||||
expect(field).not_to be_visible
|
||||
end
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'true'
|
||||
expect(field).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor", js: true do
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
expect(page).not_to have_content guardian_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_photo_heading
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
fill_in acquired_media_name_field, with: "Jane Doe"
|
||||
acquired_media_category_fields
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
click_button import_release_button
|
||||
|
||||
expect(page).to have_content successful_import_message
|
||||
expect(AcquiredMediaRelease.last.guardian_first_name).to eq 'Guardian'
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor with two guardians", js: true do
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
expect(page).not_to have_content guardian_2_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_2_photo_heading
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
expect(page).to have_content guardian_2_information_heading.upcase
|
||||
expect(page).to have_content guardian_2_photo_heading
|
||||
expect(page).to have_content guardian_2_phone_field.titleize
|
||||
|
||||
fill_in acquired_media_name_field, with: "Jane Doe"
|
||||
acquired_media_category_fields
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
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 import_release_button
|
||||
|
||||
expect(page).to have_content successful_import_message
|
||||
expect(AcquiredMediaRelease.last.guardian_first_name).to eq 'Guardian'
|
||||
expect(AcquiredMediaRelease.last.guardian_2_first_name).to eq 'Second'
|
||||
end
|
||||
|
||||
scenario "creating, updating, destroying a release", js: true do
|
||||
release_data = {
|
||||
name: "Test Acquired Media Release",
|
||||
@@ -65,7 +275,7 @@ feature "User managing acquired_media releases" do
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
by "attaching only a contract" do
|
||||
attach_file "acquired_media_release[contract]", Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
@@ -117,7 +327,7 @@ feature "User managing acquired_media releases" do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF" do
|
||||
scenario "viewing the contract PDF for an adult" do
|
||||
acquired_media_release = create(:acquired_media_release_with_contract_template,
|
||||
:native,
|
||||
project: project,
|
||||
@@ -176,6 +386,25 @@ feature "User managing acquired_media releases" do
|
||||
expect(pdf_body).to have_content("Other files")
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF for a minor" do
|
||||
acquired_media_release = create(:acquired_media_release_with_contract_template,
|
||||
:native,
|
||||
:minor,
|
||||
project: project,
|
||||
person_name: "Jane Doe")
|
||||
|
||||
visit project_acquired_media_releases_path(project)
|
||||
click_link *view_release_pdf_link_for(acquired_media_release)
|
||||
|
||||
expect(content_type).to eq("application/pdf")
|
||||
expect(pdf_body).to have_content acquired_media_release.guardian_first_name
|
||||
expect(pdf_body).to have_content acquired_media_release.guardian_last_name
|
||||
expect(pdf_body).to have_content acquired_media_release.guardian_2_first_name
|
||||
expect(pdf_body).to have_content acquired_media_release.guardian_2_last_name
|
||||
expect(pdf_body).to have_content acquired_media_release.guardian_phone
|
||||
expect(pdf_body).to have_content acquired_media_release.guardian_2_phone
|
||||
end
|
||||
|
||||
scenario "searching for a release", js: true do
|
||||
collection1 = create(:acquired_media_release, name: "EDM Music", project: project)
|
||||
collection2 = create(:acquired_media_release, name: "Classical Music", project: project)
|
||||
@@ -508,4 +737,103 @@ feature "User managing acquired_media releases" do
|
||||
def date_issued
|
||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
||||
end
|
||||
|
||||
def person_is_minor_checkbox
|
||||
'acquired_media_release_minor'
|
||||
end
|
||||
|
||||
def guardian_2_first_name_field
|
||||
t 'helpers.label.acquired_media_release.guardian_2_first_name'
|
||||
end
|
||||
|
||||
def guardian_2_last_name_field
|
||||
t 'helpers.label.acquired_media_release.guardian_2_last_name'
|
||||
end
|
||||
|
||||
def guardian_2_phone_field
|
||||
t 'helpers.label.acquired_media_release.guardian_2_phone'
|
||||
end
|
||||
|
||||
def guardian_first_name_field
|
||||
t 'helpers.label.acquired_media_release.guardian_first_name'
|
||||
end
|
||||
|
||||
def guardian_last_name_field
|
||||
t 'helpers.label.acquired_media_release.guardian_last_name'
|
||||
end
|
||||
|
||||
def guardian_phone_field
|
||||
t 'helpers.label.acquired_media_release.guardian_phone'
|
||||
end
|
||||
|
||||
def guardian_email_field
|
||||
t 'helpers.label.acquired_media_release.guardian_email'
|
||||
end
|
||||
|
||||
def guardian_address_street1_field
|
||||
t('helpers.label.acquired_media_release.guardian_address_street1')
|
||||
end
|
||||
|
||||
def guardian_address_city_field
|
||||
t('helpers.label.acquired_media_release.guardian_address_city')
|
||||
end
|
||||
|
||||
def guardian_address_state_field
|
||||
t('helpers.label.acquired_media_release.guardian_address_state')
|
||||
end
|
||||
|
||||
def guardian_address_zip_field
|
||||
t('helpers.label.acquired_media_release.guardian_address_zip')
|
||||
end
|
||||
|
||||
def guardian_photo_field
|
||||
'acquired_media_release[guardian_photo]'
|
||||
end
|
||||
|
||||
def guardian_2_photo_field
|
||||
'acquired_media_release[guardian_2_photo]'
|
||||
end
|
||||
|
||||
def fill_in_guardian_address_fields
|
||||
fill_in guardian_address_street1_field, with: "124 Test Lane"
|
||||
fill_in guardian_address_city_field, with: "New York"
|
||||
fill_in guardian_address_state_field, with: "NY"
|
||||
fill_in guardian_address_zip_field, with: '1000'
|
||||
end
|
||||
|
||||
def submit_release_button
|
||||
'I have read and agree to the above'
|
||||
end
|
||||
|
||||
def successful_submission_message
|
||||
'Your release was successfully submitted. Thank you.'
|
||||
end
|
||||
|
||||
def guardian_information_heading
|
||||
t 'public.acquired_media_releases.new.guardian_info.heading'
|
||||
end
|
||||
|
||||
def guardian_photo_heading
|
||||
t 'public.acquired_media_releases.new.guardian_photo.heading'
|
||||
end
|
||||
|
||||
def guardian_2_information_heading
|
||||
t 'public.acquired_media_releases.new.guardian_2_info.heading'
|
||||
end
|
||||
|
||||
def guardian_2_photo_heading
|
||||
t 'public.acquired_media_releases.new.guardian_2_photo.heading'
|
||||
end
|
||||
|
||||
def contract_field
|
||||
'acquired_media_release[contract]'
|
||||
end
|
||||
|
||||
def import_release_button
|
||||
t 'helpers.submit.acquired_media_releases.create'
|
||||
end
|
||||
|
||||
def successful_import_message
|
||||
t 'acquired_media_releases.create.notice'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -127,6 +127,14 @@ feature "User managing location releases" do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "listing all releases, table have correct headers", js:true do
|
||||
ct = create(:contract_template, :with_amendment_clause, project: project)
|
||||
create(:location_release, :native, project: project, contract_template: ct)
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
table_headers.each { |s| expect(page).to have_content s }
|
||||
end
|
||||
|
||||
scenario "creating a release", js: true do
|
||||
visit new_project_location_release_path(project)
|
||||
|
||||
@@ -729,4 +737,16 @@ feature "User managing location releases" do
|
||||
def amendment_signature_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signature'
|
||||
end
|
||||
|
||||
def table_headers
|
||||
[
|
||||
t('location_releases.index.table_headers.approved'),
|
||||
t('location_releases.index.table_headers.name'),
|
||||
t('location_releases.index.table_headers.address'),
|
||||
t('location_releases.index.table_headers.notes'),
|
||||
t('location_releases.index.table_headers.tags'),
|
||||
t('location_releases.index.table_headers.signed_at'),
|
||||
t('location_releases.index.table_headers.amendment_signed')
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,6 +40,93 @@ feature "User managing material releases" do
|
||||
expect(MaterialRelease.last.photos.attached?).to eq true
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'false'
|
||||
expect(field).not_to be_visible
|
||||
end
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'true'
|
||||
expect(field).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'creating a release for a minor', js: true do
|
||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).not_to have_content guardian_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_photo_heading.upcase
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading.upcase
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
fill_all_fields
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
draw_signature file_fixture("signature.png"), signature_field
|
||||
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
|
||||
scenario 'creating a release for a minor with two guardians', js: true do
|
||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).not_to have_content guardian_2_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_2_photo_heading.upcase
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading.upcase
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
expect(page).to have_content guardian_2_information_heading.upcase
|
||||
expect(page).to have_content guardian_2_photo_heading.upcase
|
||||
expect(page).to have_content guardian_2_phone_field.titleize
|
||||
|
||||
fill_all_fields
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
draw_signature file_fixture("signature.png"), signature_field
|
||||
|
||||
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(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
|
||||
end
|
||||
|
||||
scenario "creating release is possible only after filling all fields", js: true do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
@@ -98,7 +185,7 @@ feature "User managing material releases" do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "creating a release", js: true do
|
||||
scenario "creating a release for and adult", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
by "attaching only a contract" do
|
||||
@@ -120,13 +207,94 @@ feature "User managing material releases" do
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_photo("material_photo.png")
|
||||
expect(page).to have_photo("material_photo.png", visible: :all)
|
||||
|
||||
click_on "Manage"
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'false'
|
||||
expect(field).not_to be_visible
|
||||
end
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'true'
|
||||
expect(field).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
expect(page).not_to have_content guardian_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_photo_heading
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
fill_in_release_fields name: "Apple Laptop"
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
click_button import_release_button
|
||||
|
||||
expect(page).to have_content successful_import_message
|
||||
expect(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor with two guardians", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
expect(page).not_to have_content guardian_2_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_2_photo_heading
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
expect(page).to have_content guardian_2_information_heading.upcase
|
||||
expect(page).to have_content guardian_2_photo_heading
|
||||
expect(page).to have_content guardian_2_phone_field.titleize
|
||||
|
||||
fill_in_release_fields name: "Apple Laptop"
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
|
||||
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 guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
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 import_release_button
|
||||
|
||||
expect(page).to have_content successful_import_message
|
||||
expect(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
|
||||
expect(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
|
||||
end
|
||||
|
||||
scenario "updating an existing release", js: true do
|
||||
material_release = create(:material_release, :non_native, project: project)
|
||||
|
||||
@@ -190,7 +358,7 @@ feature "User managing material releases" do
|
||||
click_on "Save Changes"
|
||||
|
||||
expect(page).to have_content("The release has been updated")
|
||||
expect(page).to have_photo("material_photo.png")
|
||||
expect(page).to have_photo("material_photo.png", visible: :all)
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF" do
|
||||
@@ -419,8 +587,8 @@ feature "User managing material releases" do
|
||||
"material_release[person_address_zip]"
|
||||
end
|
||||
|
||||
def have_photo(filename)
|
||||
have_selector("img[src*='#{filename}']")
|
||||
def have_photo(filename, visible: true)
|
||||
have_selector("img[src*='#{filename}']", visible: visible)
|
||||
end
|
||||
|
||||
def import_material_release_link(project)
|
||||
@@ -542,4 +710,107 @@ feature "User managing material releases" do
|
||||
def date_issued
|
||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
||||
end
|
||||
|
||||
def person_is_minor_checkbox
|
||||
'material_release_minor'
|
||||
end
|
||||
|
||||
def guardian_2_first_name_field
|
||||
t 'helpers.label.material_release.guardian_2_first_name'
|
||||
end
|
||||
|
||||
def guardian_2_last_name_field
|
||||
t 'helpers.label.material_release.guardian_2_last_name'
|
||||
end
|
||||
|
||||
def guardian_2_phone_field
|
||||
t 'helpers.label.material_release.guardian_2_phone'
|
||||
end
|
||||
|
||||
def guardian_first_name_field
|
||||
t 'helpers.label.material_release.guardian_first_name'
|
||||
end
|
||||
|
||||
def guardian_last_name_field
|
||||
t 'helpers.label.material_release.guardian_last_name'
|
||||
end
|
||||
|
||||
def guardian_phone_field
|
||||
t 'helpers.label.material_release.guardian_phone'
|
||||
end
|
||||
|
||||
def guardian_email_field
|
||||
t 'helpers.label.material_release.guardian_email'
|
||||
end
|
||||
|
||||
def guardian_address_street1_field
|
||||
t('helpers.label.material_release.guardian_address_street1')
|
||||
end
|
||||
|
||||
def guardian_address_city_field
|
||||
t('helpers.label.material_release.guardian_address_city')
|
||||
end
|
||||
|
||||
def guardian_address_state_field
|
||||
t('helpers.label.material_release.guardian_address_state')
|
||||
end
|
||||
|
||||
def guardian_address_zip_field
|
||||
t('helpers.label.material_release.guardian_address_zip')
|
||||
end
|
||||
|
||||
def guardian_photo_field
|
||||
'material_release[guardian_photo]'
|
||||
end
|
||||
|
||||
def guardian_2_photo_field
|
||||
'material_release[guardian_2_photo]'
|
||||
end
|
||||
|
||||
def fill_in_guardian_address_fields
|
||||
fill_in guardian_address_street1_field, with: "124 Test Lane"
|
||||
fill_in guardian_address_city_field, with: "New York"
|
||||
fill_in guardian_address_state_field, with: "NY"
|
||||
fill_in guardian_address_zip_field, with: '1000'
|
||||
end
|
||||
|
||||
def submit_release_button
|
||||
'I have read and agree to the above'
|
||||
end
|
||||
|
||||
def successful_submission_message
|
||||
'Your release was successfully submitted. Thank you.'
|
||||
end
|
||||
|
||||
def guardian_information_heading
|
||||
t 'public.material_releases.new.guardian_info.heading'
|
||||
end
|
||||
|
||||
def guardian_photo_heading
|
||||
t 'public.material_releases.new.guardian_photo.heading'
|
||||
end
|
||||
|
||||
def guardian_2_information_heading
|
||||
t 'public.material_releases.new.guardian_2_info.heading'
|
||||
end
|
||||
|
||||
def guardian_2_photo_heading
|
||||
t 'public.material_releases.new.guardian_2_photo.heading'
|
||||
end
|
||||
|
||||
def contract_field
|
||||
'material_release[contract]'
|
||||
end
|
||||
|
||||
def import_release_button
|
||||
t 'helpers.submit.material_release.create'
|
||||
end
|
||||
|
||||
def successful_import_message
|
||||
t 'material_releases.create.notice'
|
||||
end
|
||||
|
||||
def signature_field
|
||||
'material_release_signature_base64'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user