add specs
This commit is contained in:
@@ -78,6 +78,38 @@ feature "User managing location releases" do
|
||||
|
||||
expect(page).to have_content dummy_signature_legal_text
|
||||
end
|
||||
|
||||
scenario "signing amendment for a not-signed amendment release", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_falsey
|
||||
|
||||
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
|
||||
click_button sign_amendment_button
|
||||
|
||||
expect(page).to have_content signed_successfully_message
|
||||
expect(LocationRelease.find(release.id).amendment_signed?).to be_truthy
|
||||
end
|
||||
|
||||
scenario "opening signing amendment page for a signed amendment release shows already signed message", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, :amendment_signed, contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_truthy
|
||||
|
||||
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).not_to have_content amendments_heading
|
||||
expect(page).not_to have_content signed_successfully_message
|
||||
expect(page).to have_content already_signed_message
|
||||
end
|
||||
end
|
||||
|
||||
context "when signed in" do
|
||||
@@ -110,7 +142,7 @@ feature "User managing location releases" do
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_photo("location_photo.png")
|
||||
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
end
|
||||
@@ -119,7 +151,7 @@ feature "User managing location releases" do
|
||||
location_release = create(:location_release_with_photo, :non_native, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
click_link *update_location_release_link(location_release)
|
||||
|
||||
within ".dropzone" do
|
||||
@@ -139,7 +171,7 @@ feature "User managing location releases" do
|
||||
location_release = create(:location_release, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
accept_alert do
|
||||
click_link *destroy_location_release_link(location_release)
|
||||
@@ -172,7 +204,7 @@ feature "User managing location releases" do
|
||||
|
||||
expect(page).to have_content("Needs Photo")
|
||||
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
click_on "Photos"
|
||||
|
||||
expect(page).to have_content("Add Photos")
|
||||
@@ -184,6 +216,71 @@ feature "User managing location releases" do
|
||||
expect(page).to have_content("The release has been updated")
|
||||
expect(page).to have_photo("location_photo.png")
|
||||
end
|
||||
|
||||
scenario "signing amendment for a not-signed amendment release", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, name: "Test Loc", contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_falsey
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Test Loc"
|
||||
|
||||
click_on manage_button
|
||||
|
||||
expect(page).to have_link sign_amendment_link
|
||||
|
||||
new_window = window_opened_by { click_link sign_amendment_link }
|
||||
within_window new_window do
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
|
||||
click_button sign_amendment_button
|
||||
|
||||
expect(page).to have_content signed_successfully_message
|
||||
expect(LocationRelease.find(release.id).amendment_signed?).to be_truthy
|
||||
end
|
||||
end
|
||||
|
||||
scenario "signed amendment release does not have sign amendment option in manage dropdown", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
release = create(:location_release, :amendment_signed, name: "Test Loc", contract_template: contract_template, project: project)
|
||||
|
||||
expect(release.amendment_signed?).to be_truthy
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Test Loc"
|
||||
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link sign_amendment_link
|
||||
end
|
||||
|
||||
scenario "signed amendment release have checked box in location releases index table", js: true do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
not_signed_release = create(:location_release, name: "Not Yet Loc", contract_template: contract_template, project: project)
|
||||
expect(not_signed_release.amendment_signed?).to be_falsey
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Not Yet Loc"
|
||||
expect(page).to have_css('i.fa.fa-square-o', count: 1)
|
||||
expect(page).to have_css('i.fa.fa-check-square', count: 0)
|
||||
|
||||
signed_release = create(:location_release, :amendment_signed, name: "Signed A Loc", contract_template: contract_template, project: project)
|
||||
expect(signed_release.amendment_signed?).to be_truthy
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
expect(page).to have_content "Signed A Loc"
|
||||
|
||||
expect(page).to have_css('i.fa.fa-square-o', count: 1)
|
||||
expect(page).to have_css('i.fa.fa-check-square-o', count: 1)
|
||||
end
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF" do
|
||||
@@ -327,7 +424,7 @@ feature "User managing location releases" do
|
||||
create(:location_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link(review_action, exact: true)
|
||||
end
|
||||
@@ -345,7 +442,7 @@ feature "User managing location releases" do
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
expect(page).not_to have_link("Download", exact: true)
|
||||
end
|
||||
|
||||
@@ -353,7 +450,7 @@ feature "User managing location releases" do
|
||||
create(:location_release_with_contract_template, :native, project: project)
|
||||
|
||||
visit project_location_releases_path(project)
|
||||
click_on "Manage"
|
||||
click_on manage_button
|
||||
|
||||
expect(page).not_to have_link(review_action, exact: true)
|
||||
end
|
||||
@@ -535,4 +632,36 @@ feature "User managing location releases" do
|
||||
def date_issued
|
||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
||||
end
|
||||
|
||||
def amendments_heading
|
||||
t 'public.amendments.new.amendment.heading'
|
||||
end
|
||||
|
||||
def amendment_signer_name_field
|
||||
'location_release[amendment_signer_name]'
|
||||
end
|
||||
|
||||
def amendment_signature_field
|
||||
'location_release_amendment_signature_base64'
|
||||
end
|
||||
|
||||
def sign_amendment_button
|
||||
t 'shared.submit_release_long'
|
||||
end
|
||||
|
||||
def already_signed_message
|
||||
t 'public.amendments.create.amendment_already_signed_message'
|
||||
end
|
||||
|
||||
def signed_successfully_message
|
||||
t 'public.amendments.create.amendment_signed_message'
|
||||
end
|
||||
|
||||
def manage_button
|
||||
t 'location_releases.location_release.actions.manage'
|
||||
end
|
||||
|
||||
def sign_amendment_link
|
||||
t 'location_releases.location_release.actions.sign_amendment'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user