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

@@ -0,0 +1,191 @@
require 'rails_helper'
feature 'User approving releasables' do
shared_examples 'an approvable UI' do
let(:current_user) { create(:user, :associate) }
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
before :each do
sign_in current_user
end
shared_examples 'not authorized to review' do
it 'does not show the review action' do
visit polymorphic_path [project, subject.model_name.plural]
click_on manage_button
expect(page).not_to have_link(review_action, exact: true)
end
end
scenario 'approval status is indicating by a checkmark' do
approved_releasable = create("#{subject.model_name.singular}", approved_at: 1.day.ago, project: project)
visit polymorphic_path [project, subject.model_name.plural]
expect(page).not_to be_approved(subject)
expect(page).not_to be_approved(approved_releasable)
end
context 'as an account manager' do
let(:current_user) { create(:user, :account_manager) }
scenario 'approving a release', js: true do
visit polymorphic_path [project, subject.model_name.plural]
click_on manage_button
click_link review_action
expect(page).to have_content review_page_heading(subject.model_name)
expect(page).to have_content approve_button
expect(page).to have_content signature_field
click_on approve_button
expect(page).not_to have_content approved_notice(subject.model_name)
expect(page).to have_content 'is not attached'
by 'adding signature' do
draw_signature file_fixture('signature.png'), signature_data_field(subject.model_name)
click_on approve_button
expect(page).to have_content approved_notice(subject.model_name)
end
end
scenario 'viewing the contract PDF for an unapproved release' do
visit polymorphic_path [project, subject.model_name.plural]
click_on 'Manage'
click_link 'Download'
expect(content_type).to eq('application/pdf')
expect(content_disposition).to include('inline')
expect(pdf_body).not_to have_content for_office_use_only
end
scenario 'viewing the contract PDF of an approved release' do
approver = create(:user, email: 'big.doe@test.com', first_name: 'Big', last_name: 'Joe')
subject.approve_by(approver)
subject.save!
visit polymorphic_path([subject, :contracts], format: 'pdf')
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
end
context 'as a manager' do
let(:current_user) { create(:user, :manager) }
include_examples 'not authorized to review'
end
context 'as an associate' do
let(:current_user) { create(:user, :associate) }
include_examples 'not authorized to review'
end
private
def approve_button
t 'approvals.new.actions.approve'
end
def approved_notice(model_name)
t('approvals.create.release_approved', release_type: model_name.human)
end
def be_approved(releasable)
releasable_dom_id = "##{releasable.model_name.singular}_#{releasable.id}"
have_css("#{releasable_dom_id }i.fa.fa-check-circle.fa-2x", count: 1)
end
def manage_button
'Manage'
end
def review_action
'Review'
end
def review_page_heading(model_name)
t 'approvals.new.heading', release_type: model_name.human.titleize
end
def signature_field
'SIGNATURE'
end
def signature_data_field(model_name)
"#{model_name.singular}_approved_by_user_signature[data]"
end
def for_office_use_only
t('contracts.for_office_use_only.heading').upcase
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
end
context 'for an appearance release' do
subject { create(:appearance_release_with_contract_template, :native, project: project) }
it_behaves_like 'an approvable UI'
end
context 'for a talent release' do
subject { create(:talent_release_with_contract_template, :native, project: project) }
it_behaves_like 'an approvable UI'
end
context 'for a location release' do
subject { create(:location_release_with_contract_template, :native, project: project) }
it_behaves_like 'an approvable UI'
end
context 'for a material release' do
subject { create(:material_release_with_contract_template, :native, project: project) }
it_behaves_like 'an approvable UI'
end
context 'for a acquired media release' do
subject { create(:acquired_media_release_with_contract_template, :native, project: project) }
it_behaves_like 'an approvable UI'
end
context 'for a medical release' do
subject { create(:medical_release_with_contract_template, :native, project: project) }
it_behaves_like 'an approvable UI'
end
context 'for a misc release' do
subject { create(:misc_release_with_contract_template, :native, project: project) }
it_behaves_like 'an approvable UI'
end
end

View File

@@ -444,104 +444,9 @@ feature "User managing acquired_media 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(:acquired_media_release_with_contract_template, :native, project: project)
visit project_acquired_media_releases_path(project)
expect(page).to have_link(review_action, exact: true)
end
scenario "Reviewing release" do
create(:acquired_media_release_with_contract_template, :native, project: project)
visit project_acquired_media_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(:acquired_media_release_with_contract_template, :native, project: project)
visit project_acquired_media_releases_path(project)
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
create(:acquired_media_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
visit project_acquired_media_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
acquired_media_release = create(:acquired_media_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_acquired_media_releases_path(project)
click_link *view_release_pdf_link_for(acquired_media_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
acquired_media_release = create(:acquired_media_release_with_contract_template,
:native,
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe')
sign_in(current_user)
visit project_acquired_media_releases_path(project)
click_link *view_release_pdf_link_for(acquired_media_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(:acquired_media_release_with_contract_template, project: project)
visit project_acquired_media_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
@@ -703,42 +608,6 @@ feature "User managing acquired_media releases" do
'Some signature legal language'
end
def review_action
t 'acquired_media_releases.acquired_media_release.actions.review'
end
def review_page_heading
t 'approvals.new.heading', release_type: "Acquired Media 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
'acquired_media_release_minor'
end

View File

@@ -687,103 +687,9 @@ feature 'User managing appearance releases' do
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(:appearance_release_with_contract_template, :native, project: project)
visit project_appearance_releases_path(project)
expect(page).to have_link(review_action, exact: true)
end
scenario "Reviewing release" do
create(:appearance_release_with_contract_template, :native, project: project)
visit project_appearance_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(:appearance_release_with_contract_template, :native, project: project)
visit project_appearance_releases_path(project)
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
create(:appearance_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
visit project_appearance_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
appearance_release = create(:appearance_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_appearance_releases_path(project)
click_link *view_release_pdf_link_for(appearance_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
appearance_release = create(:appearance_release_with_contract_template,
:native,
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe')
sign_in(current_user)
visit project_appearance_releases_path(project)
click_link *view_release_pdf_link_for(appearance_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(:appearance_release_with_contract_template, :native, project: project)
visit project_appearance_releases_path(project)
click_on manage_button
expect(page).not_to have_link(review_action, exact: true)
end
end
context 'when the user is associate' do
@@ -801,15 +707,6 @@ feature 'User managing appearance releases' do
click_on manage_button
expect(page).not_to have_link('Download', exact: true)
end
scenario "Review action in Manage menu is not visible" do
create(:appearance_release_with_contract_template, :native, project: project)
visit project_appearance_releases_path(project)
click_on manage_button
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -1039,42 +936,6 @@ feature 'User managing appearance releases' do
'Some signature legal language'
end
def review_action
t 'appearance_releases.appearance_release.actions.review'
end
def review_page_heading
t 'approvals.new.heading', release_type: "Appearance 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 amendments_heading
t 'public.amendments.new.amendment.heading'
end

View File

@@ -383,104 +383,9 @@ feature "User managing location 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(:location_release_with_contract_template, :native, project: project)
visit project_location_releases_path(project)
expect(page).to have_link(review_action, exact: true)
end
scenario "Reviewing release" do
create(:location_release_with_contract_template, :native, project: project)
visit project_location_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(:location_release_with_contract_template, :native, project: project)
visit project_location_releases_path(project)
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
create(:location_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
visit project_location_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
location_release = create(:location_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_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_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
location_release = create(:location_release_with_contract_template,
:native,
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe')
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_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(:location_release_with_contract_template, :native, project: project)
visit project_location_releases_path(project)
click_on manage_button
expect(page).not_to have_link(review_action, exact: true)
end
end
context "when the user is associate" do
@@ -498,15 +403,6 @@ feature "User managing location releases" do
click_on manage_button
expect(page).not_to have_link("Download", exact: true)
end
scenario "Review action in Manage menu is not visible" do
create(:location_release_with_contract_template, :native, project: project)
visit project_location_releases_path(project)
click_on manage_button
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -650,42 +546,6 @@ feature "User managing location releases" do
'Some signature legal language'
end
def review_action
t 'location_releases.location_release.actions.review'
end
def review_page_heading
t 'approvals.new.heading', release_type: "Location 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 amendments_heading
t 'public.amendments.new.amendment.heading'
end

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

View File

@@ -215,15 +215,6 @@ 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)
@@ -233,64 +224,6 @@ feature "User managing medical releases" do
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 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 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
scenario 'viewing contract PDF with medical questionnaire' do
contract_template = create(:medical_release_contract_template, project: project, questionnaire_legal_text: "Questionnaire legal text", question_1_text: "Question 1 text")
medical_release = create(:medical_release,
@@ -343,15 +276,6 @@ 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)
@@ -396,15 +320,6 @@ 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)
@@ -584,40 +499,4 @@ 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 'approvals.new.heading', release_type: "Medical 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
end

View File

@@ -79,83 +79,6 @@ feature "User managing misc releases" do
expect(content_type).to eq('application/pdf')
end
scenario "Review action in Manage menu is visible" do
create(:misc_release_with_contract_template, :native, project: project)
visit project_misc_releases_path(project)
expect(page).to have_link(review_action, exact: true)
end
scenario "Reviewing release" do
create(:misc_release_with_contract_template, :native, project: project)
visit project_misc_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(:misc_release_with_contract_template, :native, project: project)
visit project_misc_releases_path(project)
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
create(:misc_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
visit project_misc_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
misc_release = create(:misc_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_misc_releases_path(project)
click_link *view_release_pdf_link_for(misc_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
misc_release = create(:misc_release_with_contract_template,
:native,
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe')
sign_in(current_user)
visit project_misc_releases_path(project)
click_link *view_release_pdf_link_for(misc_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
scenario 'viewing the contract PDF' do
misc_release = create(:misc_release,
@@ -218,14 +141,6 @@ feature "User managing misc releases" do
expect(page).to have_link("Download", exact: true, count: 0)
end
scenario "Review action in Manage menu is not visible" do
create(:misc_release_with_contract_template, :native, project: project)
visit project_misc_releases_path(project)
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -300,40 +215,4 @@ feature "User managing misc releases" do
def view_release_pdf_link_for(release)
['Download', href: misc_release_contracts_path(release, format: 'pdf')]
end
def review_action
t 'misc_releases.misc_release.actions.review'
end
def review_page_heading
t 'approvals.new.heading', release_type: "Misc 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
end

View File

@@ -92,39 +92,9 @@ feature "User managing music releases" do
before do
sign_in current_user
end
scenario "Review action in Manage menu is visible" do
create(:music_release_with_contract_template, project: project)
visit project_music_releases_path(project)
click_on "Manage"
expect(page).to have_link(review_action, exact: true)
end
scenario "Reviewing release" do
create(:music_release_with_contract_template, project: project)
visit project_music_releases_path(project)
click_on "Manage"
click_link review_action
expect(page).to have_content review_page_heading
expect(page).to have_content approve_button
end
end
context "when the user is project manager" do
scenario "Review action in Manage menu is not visible" do
create(:music_release_with_contract_template, project: project)
sign_in current_user
visit project_music_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
@@ -133,24 +103,15 @@ feature "User managing music releases" do
before do
sign_in current_user
end
scenario "should not show download" do
collection1 = create(:music_release, name: "EDM Music", project: project)
visit project_music_releases_path(project)
click_on "Manage"
expect(page).not_to have_link("Download", exact: true)
end
scenario "Review action in Manage menu is not visible" do
create(:music_release_with_contract_template, project: project)
visit project_music_releases_path(project)
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -216,16 +177,4 @@ feature "User managing music releases" do
select "Other", from: "Restriction"
fill_in "Describe other restrictions", with: "Test"
end
def review_action
t 'music_releases.music_release.actions.review'
end
def review_page_heading
t 'approvals.new.heading', release_type: "Music Release"
end
def approve_button
t 'approvals.new.actions.approve'
end
end

View File

@@ -374,104 +374,9 @@ feature "User managing talent 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(:talent_release_with_contract_template, :native, project: project)
visit project_talent_releases_path(project)
expect(page).to have_link(review_action, exact: true)
end
scenario "Reviewing release" do
create(:talent_release_with_contract_template, :native, project: project)
visit project_talent_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(:talent_release_with_contract_template, :native, project: project)
visit project_talent_releases_path(project)
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
create(:talent_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
visit project_talent_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
talent_release = create(:talent_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_talent_releases_path(project)
click_link *view_release_pdf_link_for(talent_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
talent_release = create(:talent_release_with_contract_template,
:native,
project: project,
person_first_name: 'Jane',
person_last_name: 'Doe')
sign_in(current_user)
visit project_talent_releases_path(project)
click_link *view_release_pdf_link_for(talent_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(:talent_release_with_contract_template, :native, project: project)
visit project_talent_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
@@ -489,15 +394,6 @@ feature "User managing talent 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(:talent_release_with_contract_template, :native, project: project)
visit project_talent_releases_path(project)
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -679,40 +575,4 @@ feature "User managing talent releases" do
def dummy_signature_legal_text
'Some signature legal language'
end
def review_action
t 'talent_releases.talent_release.actions.review'
end
def review_page_heading
t 'approvals.new.heading', release_type: "Talent 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
end