add specs
This commit is contained in:
@@ -30,6 +30,24 @@ feature 'User managing appearance releases' do
|
|||||||
expect(page).to have_content(successful_submission_message)
|
expect(page).to have_content(successful_submission_message)
|
||||||
end
|
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_appearance_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
|
scenario 'creating a release for a minor', js: true do
|
||||||
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
|
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,24 @@ feature "User managing medical releases" do
|
|||||||
expect(page).to have_content(successful_submission_message)
|
expect(page).to have_content(successful_submission_message)
|
||||||
end
|
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_medical_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
|
scenario 'creating a release for a minor', js: true do
|
||||||
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
|
allow(BrayniacAI::Validation).to receive(:create).and_return(double(:validation, valid: true))
|
||||||
|
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ feature "User managing misc releases" do
|
|||||||
context 'when signed out' do
|
context 'when signed out' do
|
||||||
scenario 'creating a release for an adult', js: true do
|
scenario 'creating a release for an adult', js: true do
|
||||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||||
contract_template = create(:misc_release_contract_template,
|
contract_template = create(:misc_release_contract_template,
|
||||||
question_1_text: "Question 1",
|
question_1_text: "Question 1",
|
||||||
project: project)
|
project: project)
|
||||||
|
|
||||||
@@ -30,6 +30,24 @@ feature "User managing misc releases" do
|
|||||||
|
|
||||||
expect(page).to have_content(successful_submission_message)
|
expect(page).to have_content(successful_submission_message)
|
||||||
end
|
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_misc_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
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when signed in as account manager" do
|
context "when signed in as account manager" do
|
||||||
@@ -177,4 +195,8 @@ feature "User managing misc releases" do
|
|||||||
def successful_submission_message
|
def successful_submission_message
|
||||||
"Your release was successfully submitted. Thank you."
|
"Your release was successfully submitted. Thank you."
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def person_is_minor_checkbox
|
||||||
|
'misc_release_minor'
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -32,6 +32,24 @@ feature "User managing talent releases" do
|
|||||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
||||||
end
|
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_talent_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
|
scenario "creating a release for a minor", js: true do
|
||||||
contract_template = create(:contract_template, project: project)
|
contract_template = create(:contract_template, project: project)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user