Upstream sync

This commit is contained in:
Senad Uka
2020-08-24 15:52:23 +02:00
parent 41bf88e358
commit a493076f9b
25 changed files with 307 additions and 1000 deletions

View File

@@ -421,104 +421,9 @@ feature "User managing material releases" do
end
context "when the user is account manager" do
let(:current_user) { create(:user, :account_manager) }
before do
sign_in current_user
end
scenario "Review action in Manage menu is visible" do
create(:material_release_with_contract_template, :native, project: project)
visit project_material_releases_path(project)
expect(page).to have_link(review_action, exact: true)
end
scenario "Reviewing release" do
create(:material_release_with_contract_template, :native, project: project)
visit project_material_releases_path(project)
click_link review_action
expect(page).to have_content review_page_heading
expect(page).to have_content approve_button
end
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
create(:material_release_with_contract_template, :native, project: project)
visit project_material_releases_path(project)
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
create(:material_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
visit project_material_releases_path(project)
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
end
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
material_release = create(:material_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_material_releases_path(project)
click_link *view_release_pdf_link_for(material_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 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
material_release = create(:material_release_with_contract_template,
:native,
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe')
sign_in(current_user)
visit project_material_releases_path(project)
click_link *view_release_pdf_link_for(material_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 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 project manager" do
before do
sign_in current_user
end
scenario "Review action in Manage menu is not visible" do
create(:material_release_with_contract_template, :native, project: project)
visit project_material_releases_path(project)
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
end
context "when the user is associate" do
@@ -536,15 +441,6 @@ feature "User managing material releases" do
click_on "Manage"
expect(page).not_to have_link("Download", exact: true)
end
scenario "Review action in Manage menu is not visible" do
create(:material_release_with_contract_template, :native, project: project)
visit project_material_releases_path(project)
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -693,42 +589,6 @@ feature "User managing material releases" do
'Some signature legal language'
end
def review_action
t 'material_releases.material_release.actions.review'
end
def review_page_heading
t 'approvals.new.heading', release_type: "Material Release"
end
def approve_button
t 'approvals.new.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 issued_to_label
t 'contracts.for_office_use_only.description_labels.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
def person_is_minor_checkbox
'material_release_minor'
end