show amendment page in PDF contract
This commit is contained in:
@@ -301,7 +301,7 @@ feature "User managing location releases" do
|
||||
end
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF" do
|
||||
scenario "viewing the contract PDF when amendment is not yet signed" do
|
||||
location_release = create(:location_release_with_contract_template_and_photo,
|
||||
:native,
|
||||
project: project,
|
||||
@@ -313,16 +313,13 @@ feature "User managing location releases" do
|
||||
content: "Note 1",
|
||||
user: build(:user, email: "jane.doe@test.com"),
|
||||
email: "jane.doe@test.com",
|
||||
created_at: DateTime.new(2020, 2, 21, 12, 0, 0),
|
||||
),
|
||||
created_at: DateTime.new(2020, 2, 21, 12, 0, 0),),
|
||||
build(:note,
|
||||
content: "Note 2",
|
||||
user: build(:user, email: "john.doe@test.com"),
|
||||
email: "john.doe@test.com",
|
||||
created_at: DateTime.new(2020, 2, 20, 11, 0, 0),
|
||||
),
|
||||
]
|
||||
)
|
||||
created_at: DateTime.new(2020, 2, 20, 11, 0, 0),),
|
||||
])
|
||||
|
||||
sign_in(current_user)
|
||||
visit project_location_releases_path(project)
|
||||
@@ -331,6 +328,8 @@ feature "User managing location releases" do
|
||||
expect(content_type).to eq("application/pdf")
|
||||
expect(content_disposition).to include("inline")
|
||||
expect(pdf_filename).to include("benny-s-burritos")
|
||||
|
||||
expect(pdf_body).not_to have_content amendment_page_heading
|
||||
expect(pdf_body).to have_content("Benny's Burritos")
|
||||
expect(pdf_body).to have_content("NOTES")
|
||||
expect(pdf_body).to have_content("Note 1")
|
||||
@@ -347,6 +346,34 @@ feature "User managing location releases" do
|
||||
expect(pdf_body).to have_content("06:00 - 20:00")
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF when amendment is signed" do
|
||||
contract_template = create(:location_release_contract_template, :with_amendment_clause, project: project)
|
||||
location_release = create(:location_release,
|
||||
:amendment_signed,
|
||||
:native,
|
||||
contract_template: contract_template,
|
||||
project: project,
|
||||
name: "Test Loc")
|
||||
|
||||
sign_in(current_user)
|
||||
visit project_location_releases_path(project)
|
||||
click_link *view_release_pdf_link_for(location_release)
|
||||
|
||||
expect(content_type).to eq("application/pdf")
|
||||
expect(content_disposition).to include("inline")
|
||||
expect(pdf_filename).to include("test-loc")
|
||||
|
||||
expect(pdf_body).to have_content("Test Loc")
|
||||
|
||||
expect(pdf_body).to have_content amendment_page_heading
|
||||
expect(pdf_body).to have_content amendment_clause_label
|
||||
expect(pdf_body).to have_content amendment_signer_name_label
|
||||
expect(pdf_body).to have_content amendment_signature_label
|
||||
|
||||
expect(pdf_body).to have_content contract_template.amendment_clause.to_plain_text
|
||||
expect(pdf_body).to have_content location_release.amendment_signer_name
|
||||
end
|
||||
|
||||
context "when the user is account manager" do
|
||||
let(:current_user) { create(:user, :account_manager) }
|
||||
|
||||
@@ -686,4 +713,20 @@ feature "User managing location releases" do
|
||||
def copy_url_button
|
||||
t 'public.amendments.new.copy_url'
|
||||
end
|
||||
|
||||
def amendment_page_heading
|
||||
t 'contracts.amendment_page.heading'
|
||||
end
|
||||
|
||||
def amendment_signer_name_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signer_name'
|
||||
end
|
||||
|
||||
def amendment_clause_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_clause'
|
||||
end
|
||||
|
||||
def amendment_signature_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signature'
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user