Upstream sync
This commit is contained in:
@@ -109,4 +109,10 @@ feature "User creates notes" do
|
||||
|
||||
it_behaves_like "a notable collection UI"
|
||||
end
|
||||
|
||||
context "for misc releases" do
|
||||
subject! { create(:misc_release, project: project, notes: []) }
|
||||
|
||||
it_behaves_like "a notable collection UI"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -92,4 +92,10 @@ feature "User creates tags" do
|
||||
|
||||
it_behaves_like "a taggable collection UI"
|
||||
end
|
||||
|
||||
context "for misc releases" do
|
||||
subject! { create(:misc_release, project: project, tags: []) }
|
||||
|
||||
it_behaves_like "a taggable collection UI"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -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 'Guardian 2 Email'
|
||||
expect(page).to have_content 'Guardian 2 Phone'
|
||||
expect(page).to have_content 'Guardian 2 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
|
||||
'Guardian 2 first name'
|
||||
end
|
||||
|
||||
def guardian_2_last_name_field
|
||||
'Guardian 2 last name'
|
||||
end
|
||||
|
||||
def guardian_2_phone_field
|
||||
'Guardian 2 phone'
|
||||
end
|
||||
|
||||
def guardian_first_name_field
|
||||
'Guardian first name'
|
||||
end
|
||||
|
||||
55
spec/features/user_managing_misc_releases_spec.rb
Normal file
55
spec/features/user_managing_misc_releases_spec.rb
Normal file
@@ -0,0 +1,55 @@
|
||||
require "rails_helper"
|
||||
|
||||
feature "User managing misc releases" do
|
||||
let(:current_user) { create(:user) }
|
||||
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
||||
|
||||
context "when signed in as account manager" do
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "Download All is visible" do
|
||||
create(:misc_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_misc_releases_path(project)
|
||||
|
||||
expect(page).to have_content download_all_button
|
||||
end
|
||||
|
||||
scenario "Downloading PDF of native misc release is possible" do
|
||||
native_release = create(:misc_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_misc_releases_path(project)
|
||||
|
||||
click_link *view_release_pdf_link_for(native_release)
|
||||
expect(content_type).to eq('application/pdf')
|
||||
end
|
||||
end
|
||||
|
||||
context "when the user is manager(project manager)" do
|
||||
let(:current_user) { create(:user, :manager) }
|
||||
|
||||
before do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "Download action in Manage menu is not visible" do
|
||||
create(:misc_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_misc_releases_path(project)
|
||||
|
||||
expect(page).to have_link("Download", exact: true, count: 0)
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def download_all_button
|
||||
'Download All'
|
||||
end
|
||||
|
||||
def view_release_pdf_link_for(release)
|
||||
['Download', href: misc_release_contracts_path(release, format: 'pdf')]
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user