|
|
|
|
@@ -182,6 +182,18 @@ feature "User managing medical releases" do
|
|
|
|
|
sign_in current_user
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
|
|
|
|
|
create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
|
|
|
|
|
|
|
|
|
|
create(:medical_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Download All is visible" do
|
|
|
|
|
create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
create(:medical_release_with_contract_template, :non_native, project: project)
|
|
|
|
|
@@ -200,6 +212,15 @@ feature "User managing medical releases" do
|
|
|
|
|
expect(page).to have_link("Download", exact: true, count: 2)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Review action in Manage menu is visible" do
|
|
|
|
|
create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
create(:medical_release_with_contract_template, :non_native, project: project)
|
|
|
|
|
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
|
|
|
|
|
expect(page).to have_link(review_action, exact: true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Downloading PDF of native medical release is possible" do
|
|
|
|
|
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
|
|
|
|
|
@@ -208,6 +229,64 @@ feature "User managing medical releases" do
|
|
|
|
|
click_link *view_release_pdf_link_for(native_release)
|
|
|
|
|
expect(content_type).to eq('application/pdf')
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Reviewing release" do
|
|
|
|
|
create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
|
|
|
|
|
click_link review_action
|
|
|
|
|
|
|
|
|
|
expect(page).to have_content review_page_heading
|
|
|
|
|
expect(page).to have_content approve_button
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
|
|
|
medical_release = create(:medical_release_with_contract_template,
|
|
|
|
|
:native,
|
|
|
|
|
project: project,
|
|
|
|
|
person_first_name: 'Jane',
|
|
|
|
|
person_last_name: 'Doe',
|
|
|
|
|
approved_by_user_name: "Big Joe",
|
|
|
|
|
approved_by_user_email: "some@email.com",
|
|
|
|
|
approved_at: DateTime.now)
|
|
|
|
|
|
|
|
|
|
sign_in(current_user)
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
click_link *view_release_pdf_link_for(medical_release)
|
|
|
|
|
|
|
|
|
|
expect(content_type).to eq('application/pdf')
|
|
|
|
|
expect(content_disposition).to include('inline')
|
|
|
|
|
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
|
|
|
expect(pdf_body).to have_content producer_label
|
|
|
|
|
expect(pdf_body).to have_content production_label
|
|
|
|
|
expect(pdf_body).to have_content employee_issued_to_label
|
|
|
|
|
expect(pdf_body).to have_content issued_by_label
|
|
|
|
|
expect(pdf_body).to have_content date_issued
|
|
|
|
|
expect(pdf_body).to have_content 'Big Joe'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
|
|
|
medical_release = create(:medical_release_with_contract_template,
|
|
|
|
|
:native,
|
|
|
|
|
project: project,
|
|
|
|
|
person_first_name: 'Jane',
|
|
|
|
|
person_last_name: 'Doe')
|
|
|
|
|
|
|
|
|
|
sign_in(current_user)
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
click_link *view_release_pdf_link_for(medical_release)
|
|
|
|
|
|
|
|
|
|
expect(content_type).to eq('application/pdf')
|
|
|
|
|
expect(content_disposition).to include('inline')
|
|
|
|
|
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
|
|
|
expect(pdf_body).not_to have_content producer_label
|
|
|
|
|
expect(pdf_body).not_to have_content production_label
|
|
|
|
|
expect(pdf_body).not_to have_content employee_issued_to_label
|
|
|
|
|
expect(pdf_body).not_to have_content issued_by_label
|
|
|
|
|
expect(pdf_body).not_to have_content date_issued
|
|
|
|
|
expect(pdf_body).not_to have_content 'Big Joe'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
context "when the user is manager(project manager)" do
|
|
|
|
|
@@ -235,6 +314,15 @@ feature "User managing medical releases" do
|
|
|
|
|
expect(page).to have_link("Download", exact: true, count: 0)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Review action in Manage menu is not visible" do
|
|
|
|
|
create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
create(:medical_release_with_contract_template, :non_native, project: project)
|
|
|
|
|
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
|
|
|
|
|
expect(page).not_to have_link(review_action, exact: true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Downloading PDF of native medical release is not possible" do
|
|
|
|
|
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
|
|
|
|
|
@@ -279,6 +367,15 @@ feature "User managing medical releases" do
|
|
|
|
|
expect(page).to have_link("Download", exact: true, count: 0)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Review action in Manage menu is not visible" do
|
|
|
|
|
create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
create(:medical_release_with_contract_template, :non_native, project: project)
|
|
|
|
|
|
|
|
|
|
visit project_medical_releases_path(project)
|
|
|
|
|
|
|
|
|
|
expect(page).not_to have_link(review_action, exact: true)
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
scenario "Downloading PDF of native medical release is not possible" do
|
|
|
|
|
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
|
|
|
|
|
|
|
|
|
@@ -458,4 +555,40 @@ feature "User managing medical releases" do
|
|
|
|
|
def dummy_signature_legal_text
|
|
|
|
|
'Some signature legal language'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def review_action
|
|
|
|
|
t 'medical_releases.medical_release.actions.review'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def review_page_heading
|
|
|
|
|
t 'medical_releases.review.heading'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def approve_button
|
|
|
|
|
t 'medical_releases.review.actions.approve'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def for_office_use_only
|
|
|
|
|
t 'contracts.for_office_use_only.heading'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def producer_label
|
|
|
|
|
t 'contracts.for_office_use_only.description_labels.producer'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def production_label
|
|
|
|
|
t 'contracts.for_office_use_only.description_labels.production'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def employee_issued_to_label
|
|
|
|
|
t 'contracts.for_office_use_only.description_labels.employee_issued_to'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def issued_by_label
|
|
|
|
|
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
def date_issued
|
|
|
|
|
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
|
|
|
end
|
|
|
|
|
end
|
|
|
|
|
|