Usptream sync

This commit is contained in:
Senad Uka
2020-07-20 13:28:40 +00:00
parent add8304eab
commit 40f241b75f
74 changed files with 12779 additions and 71 deletions

View File

@@ -213,13 +213,117 @@ feature "User managing acquired_media releases" do
expect(page).not_to have_link("Edit", exact: true)
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
let(:current_user) { create(:user, :associate) }
before do
sign_in current_user
end
scenario "should not show download" do
collection1 = create(:acquired_media_release_with_contract_template, name: "EDM Music", project: project)
sign_in current_user
visit project_acquired_media_releases_path(project)
click_on "Manage"
@@ -368,4 +472,40 @@ feature "User managing acquired_media releases" do
def dummy_signature_legal_text
'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
end

View File

@@ -481,18 +481,131 @@ feature 'User managing appearance releases' do
end
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(: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"
expect(page).not_to have_link(review_action, exact: true)
end
end
context 'when the user is associate' do
let(:current_user) { create(:user, :associate) }
before do
sign_in current_user
end
scenario 'should not show download' do
chris = create(:appearance_release_with_contract_template, person_first_name: 'Chris', person_last_name: 'Evans', project: project)
sign_in current_user
visit project_appearance_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(:appearance_release_with_contract_template, :native, project: project)
visit project_appearance_releases_path(project)
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -717,4 +830,40 @@ feature 'User managing appearance releases' do
def dummy_signature_legal_text
'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
end

View File

@@ -78,6 +78,39 @@ feature 'User managing broadcasts' do
expect(page).to have_content token_reset_notice
end
scenario 'Player will not reload if stream is reactivated while user is watching previous recording', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
visit project_broadcast_path(project, broadcast)
expect(page).to have_content stream_idle_message
broadcast.streamer_status = :recording
broadcast.status = :active
BroadcastsChannel.broadcast_stream_updates(broadcast)
expect(page).to have_content stream_begun_message
expect(page).to have_selector('div#broadcast_video', count: 1)
broadcast.streamer_status = :idle
broadcast.status = :idle
BroadcastsChannel.broadcast_stream_updates(broadcast)
click_on switch_view_dropdown
click_on recording.download_file_name
expect(page).to have_content stream_idle_message
expect(page).to have_selector('div#broadcast_video', count: 1)
broadcast.streamer_status = :recording
broadcast.status = :active
BroadcastsChannel.broadcast_stream_updates(broadcast)
expect(page).to have_content stream_begun_message
expect(page).to have_selector('div#broadcast_video', count: 1)
end
scenario 'user can go back and forth between live session and previous sessions', js: true do
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
recording = create(:broadcast_recording, broadcast: broadcast)
@@ -212,4 +245,14 @@ feature 'User managing broadcasts' do
def token_reset_notice
t 'broadcasts.update.reset_notice'
end
def stream_begun_message
'Live stream has begun, click play to watch it'
end
def stream_idle_message
'Live stream is waiting to begin'
end
end

View File

@@ -232,18 +232,131 @@ feature "User managing location releases" do
expect(pdf_body).to have_content("06:00 - 20:00")
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"
expect(page).not_to have_link(review_action, exact: true)
end
end
context "when the user is associate" do
let(:current_user) { create(:user, :associate) }
before do
sign_in current_user
end
scenario "should not show download" do
create(:location_release_with_contract_template, name: "Cheers", project: project)
sign_in current_user
visit project_location_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(:location_release_with_contract_template, :native, project: project)
visit project_location_releases_path(project)
click_on "Manage"
expect(page).not_to have_link(review_action, exact: true)
end
end
private
@@ -386,4 +499,40 @@ feature "User managing location releases" do
def dummy_signature_legal_text
'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
end

View File

@@ -234,18 +234,131 @@ feature "User managing material releases" do
end
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
let(:current_user) { create(:user, :associate) }
before do
sign_in current_user
end
scenario "should not show download" do
create(:material_release_with_contract_template, name: "Apple MacBook Air", project: project)
sign_in current_user
visit project_material_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(: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
@@ -393,4 +506,40 @@ feature "User managing material releases" do
def dummy_signature_legal_text
'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
end

View File

@@ -561,7 +561,7 @@ feature "User managing medical releases" do
end
def review_page_heading
t 'approvals.new.heading'
t 'approvals.new.heading', release_type: "Medical Release"
end
def approve_button

View File

@@ -79,6 +79,84 @@ 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,
:native,
@@ -140,6 +218,14 @@ 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
@@ -210,4 +296,44 @@ feature "User managing misc releases" do
def dummy_signature_legal_text
'Some signature legal language'
end
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

@@ -86,18 +86,71 @@ feature "User managing music releases" do
expect(page).to have_field("Search", with: "EDM")
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(: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
let(:current_user) { create(:user, :associate) }
before do
sign_in current_user
end
scenario "should not show download" do
collection1 = create(:music_release, name: "EDM Music", project: project)
sign_in current_user
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
@@ -163,4 +216,16 @@ 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

@@ -373,18 +373,131 @@ feature "User managing talent releases" do
end
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
let(:current_user) { create(:user, :associate) }
before do
sign_in current_user
end
scenario "should not show download" do
create(:talent_release_with_contract_template, person_first_name: "Robert", person_last_name: "Downey Jr.", project: project)
sign_in current_user
visit project_talent_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(: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
@@ -566,4 +679,40 @@ 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

View File

@@ -91,6 +91,21 @@ feature "User managing task requests" do
expect(page).to have_content add_new_project_label
end
scenario "user can click Chat Now and start chat event with a blank form" do
visit project_task_requests_path(project)
click_on create_task_request
expect(page).to have_content chat_now_button
expect(page).to have_content form_notice
expect do
click_on chat_now_button
end.to change(TaskRequest, :count).by(1)
expect(page).to have_content task_request_created_notice
end
private
def no_task_requests_label
@@ -120,4 +135,20 @@ feature "User managing task requests" do
def schedule_demo
t 'task_requests.splash.actions.book_demo'
end
def create_task_request
t 'task_requests.index.actions.new'
end
def chat_now_button
t 'task_requests.form.actions.chat_now'
end
def form_notice
t 'task_requests.form.info_message'
end
def task_request_created_notice
t 'task_requests.create.success_message'
end
end