Initial teams commit
This commit is contained in:
@@ -35,7 +35,7 @@ RSpec.describe BroadcastsChannel, type: :channel do
|
||||
describe '#stream_recording_ready' do
|
||||
it 'broadcasts to the channel with the right data' do
|
||||
create_list(:broadcast_recording, 1, broadcast: broadcast)
|
||||
recordings = broadcast.broadcast_recordings.visible.paginate(page: 1)
|
||||
recordings = broadcast.broadcast_recordings.paginate(page: 1)
|
||||
flash_message = OpenStruct.new(notice: 'Hello world', alert: nil)
|
||||
flash_content = ApplicationController.render partial: 'application/flash', locals: { flash: flash_message }
|
||||
recordings_content = ApplicationController.render partial: 'broadcasts/broadcast_recordings', locals: { recordings: recordings, broadcast: broadcast }
|
||||
|
||||
@@ -116,16 +116,6 @@ RSpec.describe Admin::AccountsController, type: :controller do
|
||||
expect(response.body).to have_link("2", href: admin_account_path(current_user.primary_account, page: 2))
|
||||
end
|
||||
|
||||
it "paginates the broadcast list" do
|
||||
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
|
||||
project = create(:project, account: current_user.primary_account)
|
||||
create_list(:broadcast, 20, project: project )
|
||||
|
||||
get :show, params: { id: current_user.primary_account }
|
||||
|
||||
expect(response.body).to have_link("2", href: admin_account_path(current_user.primary_account, page: 2))
|
||||
end
|
||||
|
||||
it "filters the videos by a query param" do
|
||||
project = create(:project, account: current_user.primary_account)
|
||||
create(:video, project: project, name: "First video")
|
||||
|
||||
@@ -1,77 +0,0 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe Admin::BroadcastsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let!(:current_user) { create(:user, :admin) }
|
||||
|
||||
before do
|
||||
sign_in(current_user)
|
||||
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
|
||||
end
|
||||
|
||||
describe "#edit" do
|
||||
let(:broadcast) { create(:broadcast) }
|
||||
|
||||
it "returns a successful response" do
|
||||
get :edit, params: { id: broadcast }
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it "assigns broadcast" do
|
||||
get :edit, params: { id: broadcast }
|
||||
|
||||
expect(assigns(:broadcast)).to eq broadcast
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update" do
|
||||
let(:broadcast) { create(:broadcast) }
|
||||
|
||||
it "redirects to broadcasts page" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(response).to be_redirect
|
||||
expect(response).to redirect_to [:admin, broadcast.project.account]
|
||||
end
|
||||
|
||||
it "sets a flash notice" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(flash.notice).to eq "The broadcast has been updated"
|
||||
end
|
||||
|
||||
it "updates the broadcast record" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(assigns(:broadcast)).to have_attributes(
|
||||
stream_url_override: "https://example.com/streams/abcd",
|
||||
stream_key_override: "abcdef",
|
||||
)
|
||||
end
|
||||
|
||||
context "when record cannot be saved" do
|
||||
before do
|
||||
allow_any_instance_of(Broadcast).to receive(:update).and_return(false)
|
||||
end
|
||||
|
||||
it "re-displays the form" do
|
||||
patch :update, params: { id: broadcast, broadcast: broadcast_update_params }
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(flash.notice).to be_nil
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def broadcast_update_params
|
||||
{
|
||||
stream_url_override: "https://example.com/streams/abcd",
|
||||
stream_key_override: "abcdef",
|
||||
director_mode_video_embed: "<iframe>Video player</iframe>",
|
||||
}
|
||||
end
|
||||
end
|
||||
@@ -94,7 +94,7 @@ RSpec.describe Api::SyncController, type: :controller do
|
||||
expect(appearance_releases.first).to include('guardian_photo')
|
||||
expect(talent_releases.first).to include('guardian_photo')
|
||||
expect(location_releases.first).not_to include('guardian_photo')
|
||||
expect(material_releases.first).to include('guardian_photo')
|
||||
expect(material_releases.first).not_to include('guardian_photo')
|
||||
end
|
||||
|
||||
it 'guardian photo has same format as other photos' do
|
||||
|
||||
@@ -1,63 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::UserTokenController, type: :request do
|
||||
let(:current_user) { create(:user) }
|
||||
|
||||
describe '#create' do
|
||||
it 'returns error if credentials are not corrent and does not set cookie' do
|
||||
|
||||
post create_endpoint, params: wrong_auth_params
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.body).to match record_not_found
|
||||
expect(cookie_data).to eq nil
|
||||
end
|
||||
|
||||
it 'sends token and cookie if credentials are correct' do
|
||||
post create_endpoint, params: correct_auth_params
|
||||
|
||||
expect(response).to be_successful
|
||||
expect(response.body).not_to match record_not_found
|
||||
expect(response.body).to match token_response
|
||||
expect(cookie_data).not_to eq nil
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def wrong_auth_params
|
||||
{
|
||||
auth: {
|
||||
email: 'wrong_email@api-test.com',
|
||||
password: 'password'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def correct_auth_params
|
||||
{
|
||||
auth: {
|
||||
email: current_user.email,
|
||||
password: 'password'
|
||||
}
|
||||
}
|
||||
end
|
||||
|
||||
def create_endpoint
|
||||
'/api/v1/user_token'
|
||||
end
|
||||
|
||||
def record_not_found
|
||||
/Record not found/
|
||||
end
|
||||
|
||||
def token_response
|
||||
/jwt/
|
||||
end
|
||||
|
||||
def cookie_data
|
||||
cookies[:_easy_release_session]
|
||||
end
|
||||
end
|
||||
@@ -1,78 +0,0 @@
|
||||
# frozen_string_literal: true
|
||||
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe Api::UsersController, type: :controller do
|
||||
before do
|
||||
ENV['CUSTOM_API_TOKEN'] = "custom_token"
|
||||
end
|
||||
describe '#create' do
|
||||
context 'Invalid token' do
|
||||
it 'Returns 401 (Unauthorized) status if token is not valid' do
|
||||
|
||||
post :create
|
||||
|
||||
expect(response).not_to be_successful
|
||||
expect(response).to have_http_status(401)
|
||||
end
|
||||
end
|
||||
|
||||
context 'Valid token' do
|
||||
before :each do
|
||||
controller.request.env['HTTP_AUTHORIZATION'] = 'Bearer custom_token'
|
||||
end
|
||||
|
||||
it 'Returns Server error if user param is missing' do
|
||||
user_count = User.all.count
|
||||
|
||||
expect do
|
||||
post :create
|
||||
end.to raise_exception ActionController::ParameterMissing
|
||||
|
||||
expect(User.all.count).to eq user_count
|
||||
end
|
||||
|
||||
it 'Returns Server Error if email or password is missing' do
|
||||
user_count = User.all.count
|
||||
|
||||
expect do
|
||||
post :create, params: { user: { email: "a@b.com" } }
|
||||
end.to raise_exception ActionController::ParameterMissing
|
||||
|
||||
expect do
|
||||
post :create, params: { user: { password: "123" } }
|
||||
end.to raise_exception ActionController::ParameterMissing
|
||||
|
||||
expect(User.all.count).to eq user_count
|
||||
end
|
||||
|
||||
it 'Returns Server Error if body contains not permitted params' do
|
||||
user_count = User.all.count
|
||||
|
||||
expect do
|
||||
post :create, params: { user: { email: "a@b.com", password: "123", admin: true } }
|
||||
end.to raise_exception ActionController::UnpermittedParameters
|
||||
|
||||
expect(User.all.count).to eq user_count
|
||||
end
|
||||
|
||||
it 'Creates user if body contains correct params' do
|
||||
expect do
|
||||
post :create, params: { user: { email: "a@b.com", password: "123" } }
|
||||
end.to change(User, :count).by(1)
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it 'Nothing changes if existing email is used' do
|
||||
create(:user, email: "a@b.com")
|
||||
|
||||
expect do
|
||||
post :create, params: { user: { email: "a@b.com", password: "123" } }
|
||||
end.not_to change(User, :count)
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,30 +0,0 @@
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe BroadcastRecordingsController, type: :controller do
|
||||
render_views
|
||||
|
||||
let(:user) { create(:user) }
|
||||
let(:account) { user.primary_account }
|
||||
let(:project) { create(:project, account: user.primary_account) }
|
||||
|
||||
before do
|
||||
sign_in user
|
||||
end
|
||||
|
||||
describe "#destroy" do
|
||||
let(:broadcast) { create(:broadcast, project: project, name: "New Broadcast") }
|
||||
let(:recording) { create(:broadcast_recording, broadcast: broadcast) }
|
||||
|
||||
before do
|
||||
allow(MuxLiveStream).to receive(:new).and_return(double(id: "id", key: "key", playback_id: "playback_id"))
|
||||
end
|
||||
|
||||
it "hides the broadcast recording" do
|
||||
expect(recording.hidden).to be false
|
||||
|
||||
post :destroy, params: { project_id: project, broadcast_id: broadcast, id: recording }, xhr: true
|
||||
|
||||
expect(recording.reload.hidden).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -184,35 +184,6 @@ RSpec.describe BroadcastsController, type: :controller do
|
||||
expect(response.body).to have_selector(".dropdown-menu a.dropdown-item", text: recording.download_file_name)
|
||||
end
|
||||
end
|
||||
|
||||
context "when virtual director video embed is available" do
|
||||
let(:broadcast) { create(:broadcast, project: project, name: "Another Broadcast",
|
||||
director_mode_video_embed: "<iframe>video player</iframe>") }
|
||||
|
||||
it "renders the view dropdown with a director mode enable option" do
|
||||
get :show, params: { project_id: project, id: broadcast }
|
||||
|
||||
expect(response.body).to have_content "Switch View"
|
||||
expect(response.body).to have_selector(".dropdown-menu h5.dropdown-header", text: "Director Mode")
|
||||
expect(response.body).to have_selector(".dropdown-menu a.dropdown-item", text: "Enable Director Mode")
|
||||
end
|
||||
|
||||
context "when director mode is enabled" do
|
||||
it "shows the video embed" do
|
||||
get :show, params: { project_id: project, id: broadcast, director_mode: true }
|
||||
|
||||
expect(response.body).to have_selector("iframe", text: "video player")
|
||||
end
|
||||
|
||||
it "renders the view dropdown with a director mode disable option" do
|
||||
get :show, params: { project_id: project, id: broadcast, director_mode: true }
|
||||
|
||||
expect(response.body).to have_content "Switch View"
|
||||
expect(response.body).to have_selector(".dropdown-menu h5.dropdown-header", text: "Director Mode")
|
||||
expect(response.body).to have_selector(".dropdown-menu a.dropdown-item", text: "Disable Director Mode")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#update" do
|
||||
|
||||
@@ -4,22 +4,6 @@ FactoryBot.define do
|
||||
|
||||
name "Test Acquired Media Release"
|
||||
|
||||
trait :with_address do
|
||||
person_address_street1 "St1"
|
||||
person_address_street2 "St2"
|
||||
person_address_city "City"
|
||||
person_address_state "State"
|
||||
person_address_zip "123"
|
||||
person_address_country "US"
|
||||
end
|
||||
|
||||
trait :with_owner_info do
|
||||
person_first_name "Jane"
|
||||
person_last_name "Doe"
|
||||
person_phone "100-555-1001"
|
||||
person_email "owner@email.com"
|
||||
end
|
||||
|
||||
trait :native do
|
||||
signature do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "signature.png")
|
||||
|
||||
@@ -3,7 +3,6 @@ FactoryBot.define do
|
||||
association :broadcast
|
||||
file_name "high.mp4"
|
||||
asset_uid "asset_uid"
|
||||
asset_playback_uid "asset_playback_uid"
|
||||
hidden { false }
|
||||
asset_playback_uid "asset_playback_uid"
|
||||
end
|
||||
end
|
||||
|
||||
@@ -16,17 +16,6 @@ FactoryBot.define do
|
||||
streamer_status "idle"
|
||||
end
|
||||
|
||||
trait :with_overriden_stream do
|
||||
stream_uid "mux_stream"
|
||||
stream_key "mux_key"
|
||||
stream_playback_uid "mux_playback_id"
|
||||
full_live_stream_playback_uid "full_live_stream_playback_uid"
|
||||
status "created"
|
||||
streamer_status "idle"
|
||||
stream_url_override "overriden_stream_url"
|
||||
stream_key_override "overriden_stream_key"
|
||||
end
|
||||
|
||||
trait :with_files do
|
||||
files do
|
||||
[
|
||||
|
||||
@@ -4,20 +4,10 @@ FactoryBot.define do
|
||||
|
||||
name "Test Materials"
|
||||
|
||||
trait :with_address do
|
||||
person_address_street1 "St1"
|
||||
person_address_street2 "St2"
|
||||
person_address_city "City"
|
||||
person_address_state "State"
|
||||
person_address_zip "123"
|
||||
person_address_country "US"
|
||||
end
|
||||
|
||||
trait :native do
|
||||
person_first_name "Jane"
|
||||
person_last_name "Doe"
|
||||
person_phone "100-555-1001"
|
||||
person_email "owner@email.com"
|
||||
|
||||
signature do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "signature.png")
|
||||
@@ -25,16 +15,6 @@ FactoryBot.define do
|
||||
end
|
||||
end
|
||||
|
||||
trait :minor do
|
||||
minor true
|
||||
guardian_first_name "Guardian1"
|
||||
guardian_last_name "First"
|
||||
guardian_2_first_name "Guardian2"
|
||||
guardian_2_last_name "Second"
|
||||
guardian_phone "1111"
|
||||
guardian_2_phone "2222"
|
||||
end
|
||||
|
||||
trait :with_photo do
|
||||
photos do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "material_photo.png")
|
||||
|
||||
@@ -178,7 +178,7 @@ RSpec.feature 'User manages contract templates', type: :feature do
|
||||
expect(content_disposition).to include('inline')
|
||||
expect(pdf_body).to have_content('PREVIEW ONLY')
|
||||
expect(pdf_body).to have_content('Material Release')
|
||||
expect(pdf_body).to have_content('Guardian')
|
||||
expect(pdf_body).not_to have_content('Guardian')
|
||||
end
|
||||
|
||||
context 'preventing creation of release template with wrong fee value' do
|
||||
|
||||
@@ -51,13 +51,6 @@ RSpec.feature "User manages project custom folders", type: :feature do
|
||||
|
||||
expect(page).to have_content("UPLOAD NEW FILES")
|
||||
|
||||
expect do
|
||||
click_button "Upload Files"
|
||||
end.not_to raise_exception
|
||||
|
||||
expect(page).to have_content("UPLOAD NEW FILES")
|
||||
expect(page).not_to have_content("The folder has been updated")
|
||||
|
||||
drop_file Rails.root.join(file_fixture("person_photo.png")), type: :dropzone
|
||||
|
||||
click_button "Upload Files"
|
||||
|
||||
@@ -165,24 +165,6 @@ feature "User managing acquired_media releases" do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "index table shows owner info" do
|
||||
release = create(:acquired_media_release, :with_owner_info, :with_address, project: project)
|
||||
|
||||
visit project_acquired_media_releases_path(project)
|
||||
|
||||
expect(page).to have_content owner_info_table_header
|
||||
|
||||
expect(page).to have_content release.person_first_name
|
||||
expect(page).to have_content release.person_last_name
|
||||
expect(page).to have_content release.person_phone
|
||||
expect(page).to have_content release.person_email
|
||||
expect(page).to have_content release.person_address_street1
|
||||
expect(page).to have_content release.person_address_city
|
||||
expect(page).to have_content release.person_address_state
|
||||
expect(page).to have_content release.person_address_zip
|
||||
expect(page).to have_content release.person_address_country
|
||||
end
|
||||
|
||||
scenario "creating a release for an adult", js: true do
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
@@ -280,63 +262,62 @@ feature "User managing acquired_media releases" do
|
||||
end
|
||||
|
||||
scenario "creating, updating, destroying a release", js: true do
|
||||
resize_window_to(1_000, 1_000) do
|
||||
release_data = {
|
||||
name: "Test Acquired Media Release",
|
||||
applicable_media: ApplicableMedium.last.label,
|
||||
territory: Territory.last.label,
|
||||
term: Term.last.label,
|
||||
restriction: Restriction.first.label,
|
||||
restriction_text: "Not available in China",
|
||||
}
|
||||
release_data = {
|
||||
name: "Test Acquired Media Release",
|
||||
applicable_media: ApplicableMedium.last.label,
|
||||
territory: Territory.last.label,
|
||||
term: Term.last.label,
|
||||
restriction: Restriction.first.label,
|
||||
restriction_text: "Not available in China",
|
||||
}
|
||||
|
||||
sign_in current_user
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
sign_in current_user
|
||||
visit new_project_acquired_media_release_path(project)
|
||||
|
||||
by "attaching only a contract" do
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
click_button create_release_button
|
||||
by "attaching only a contract" do
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
end
|
||||
|
||||
by "attaching files" do
|
||||
drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone"
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
end
|
||||
|
||||
by "filling out the remaining information" do
|
||||
fill_in_release_fields release_data
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_content("1")
|
||||
|
||||
click_on "Manage"
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
|
||||
it_also "updates an existing release" do
|
||||
click_link "Edit"
|
||||
|
||||
within ".dropzone" do
|
||||
expect(page).to have_filename("video_file.mp4")
|
||||
end
|
||||
|
||||
by "attaching files" do
|
||||
drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone"
|
||||
click_button create_release_button
|
||||
expect(page).to have_filled_in_data(release_data)
|
||||
|
||||
expect(page).to have_invalid_field(acquired_media_name_field)
|
||||
end
|
||||
fill_in_release_fields name: "New name"
|
||||
drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone"
|
||||
click_button update_release_button
|
||||
|
||||
by "filling out the remaining information" do
|
||||
fill_in_release_fields release_data
|
||||
click_button create_release_button
|
||||
expect(page).to have_content(update_release_notice)
|
||||
expect(page).to have_content("New name")
|
||||
expect(page).to have_content("2")
|
||||
end
|
||||
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_content("1")
|
||||
|
||||
click_on "Manage"
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
|
||||
it_also "updates an existing release" do
|
||||
click_link "Edit"
|
||||
|
||||
within ".dropzone" do
|
||||
expect(page).to have_filename("video_file.mp4")
|
||||
end
|
||||
|
||||
expect(page).to have_filled_in_data(release_data)
|
||||
|
||||
fill_in_release_fields name: "New name"
|
||||
drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone"
|
||||
click_button update_release_button
|
||||
|
||||
expect(page).to have_content(update_release_notice)
|
||||
expect(page).to have_content("New name")
|
||||
expect(page).to have_content("2")
|
||||
end
|
||||
|
||||
it_also "deletes an existing release" do
|
||||
it_also "deletes an existing release" do
|
||||
click_button "Manage"
|
||||
accept_alert do
|
||||
click_link "Delete"
|
||||
@@ -344,7 +325,6 @@ feature "User managing acquired_media releases" do
|
||||
|
||||
expect(page).not_to have_content("New name")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF for an adult" do
|
||||
@@ -856,8 +836,4 @@ feature "User managing acquired_media releases" do
|
||||
def successful_import_message
|
||||
t 'acquired_media_releases.create.notice'
|
||||
end
|
||||
|
||||
def owner_info_table_header
|
||||
t 'acquired_media_releases.index.table_headers.owner_info'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
require 'rails_helper'
|
||||
|
||||
feature 'User managing broadcasts' do
|
||||
|
||||
let(:current_user) { create(:user, :manager) }
|
||||
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
||||
|
||||
@@ -51,7 +50,7 @@ feature 'User managing broadcasts' do
|
||||
|
||||
scenario 'visit show page of broadcast', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "asset_uid_1")
|
||||
recording = create(:broadcast_recording, broadcast: broadcast)
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
@@ -205,24 +204,6 @@ feature 'User managing broadcasts' do
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'project manager can hide broadcast recordings', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
click_on 'Previous Sessions'
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
expect(page).to have_content('Hide')
|
||||
|
||||
accept_alert do
|
||||
click_link "Hide"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content(recording.download_file_name)
|
||||
expect(page).to have_content("Recording of the live stream will appear here")
|
||||
end
|
||||
|
||||
context 'When the user is associate' do
|
||||
let(:current_user) { create(:user, :associate) }
|
||||
|
||||
@@ -240,17 +221,6 @@ feature 'User managing broadcasts' do
|
||||
|
||||
expect(page).to have_content delete_file_button, count: 0
|
||||
end
|
||||
|
||||
scenario 'associate does not see hide button in front of recording' do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
click_on 'Previous Sessions'
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
expect(page).not_to have_content('Hide')
|
||||
end
|
||||
end
|
||||
|
||||
context 'When the user is account manager' do
|
||||
@@ -277,24 +247,6 @@ feature 'User managing broadcasts' do
|
||||
expect(page).to have_content delete_file_button, count: 2
|
||||
expect(Broadcast.find(broadcast.id).files.count).to eq 2
|
||||
end
|
||||
|
||||
scenario 'account manager can hide broadcast recordings', js: true do
|
||||
broadcast = create(:broadcast, :with_stream, :with_files, project: project)
|
||||
recording = create(:broadcast_recording, broadcast: broadcast, asset_uid: "another_asset_uid")
|
||||
|
||||
visit project_broadcast_path(project, broadcast)
|
||||
|
||||
click_on 'Previous Sessions'
|
||||
expect(page).to have_content(recording.download_file_name)
|
||||
expect(page).to have_content('Hide')
|
||||
|
||||
accept_alert do
|
||||
click_link "Hide"
|
||||
end
|
||||
|
||||
expect(page).not_to have_content(recording.download_file_name)
|
||||
expect(page).to have_content("Recording of the live stream will appear here")
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
@@ -87,7 +87,7 @@ feature "User managing location releases" do
|
||||
|
||||
visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
|
||||
|
||||
expect(page).to have_content amendments_heading.upcase
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
@@ -127,14 +127,6 @@ feature "User managing location releases" do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "listing all releases, table have correct headers", js:true do
|
||||
ct = create(:contract_template, :with_amendment_clause, project: project)
|
||||
create(:location_release, :native, project: project, contract_template: ct)
|
||||
visit project_location_releases_path(project)
|
||||
|
||||
table_headers.each { |s| expect(page).to have_content s }
|
||||
end
|
||||
|
||||
scenario "creating a release", js: true do
|
||||
visit new_project_location_release_path(project)
|
||||
|
||||
@@ -250,7 +242,7 @@ feature "User managing location releases" do
|
||||
|
||||
new_window = window_opened_by { click_link sign_amendment_link }
|
||||
within_window new_window do
|
||||
expect(page).to have_content amendments_heading.upcase
|
||||
expect(page).to have_content amendments_heading
|
||||
|
||||
fill_in amendment_signer_name_field, with: 'Big Signer'
|
||||
draw_signature file_fixture("signature.png"), amendment_signature_field
|
||||
@@ -690,10 +682,6 @@ feature "User managing location releases" do
|
||||
t 'public.amendments.new.amendment.heading'
|
||||
end
|
||||
|
||||
def signed_contract_preview
|
||||
t 'public.amendments.new.signed_contract_preview'
|
||||
end
|
||||
|
||||
def amendment_signer_name_field
|
||||
'location_release[amendment_signer_name]'
|
||||
end
|
||||
@@ -741,16 +729,4 @@ feature "User managing location releases" do
|
||||
def amendment_signature_label
|
||||
t 'contracts.amendment_page.description_labels.amendment_signature'
|
||||
end
|
||||
|
||||
def table_headers
|
||||
[
|
||||
t('location_releases.index.table_headers.approved'),
|
||||
t('location_releases.index.table_headers.location_info'),
|
||||
t('location_releases.index.table_headers.owner_info'),
|
||||
t('location_releases.index.table_headers.notes'),
|
||||
t('location_releases.index.table_headers.tags'),
|
||||
t('location_releases.index.table_headers.signed_at'),
|
||||
t('location_releases.index.table_headers.amendment_signed')
|
||||
]
|
||||
end
|
||||
end
|
||||
|
||||
@@ -40,93 +40,6 @@ feature "User managing material releases" do
|
||||
expect(MaterialRelease.last.photos.attached?).to eq true
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'false'
|
||||
expect(field).not_to be_visible
|
||||
end
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'true'
|
||||
expect(field).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
scenario 'creating a release for a minor', js: true do
|
||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).not_to have_content guardian_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_photo_heading.upcase
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading.upcase
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
fill_all_fields
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
fill_in guardian_phone_field, with: '001101'
|
||||
fill_in guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
draw_signature file_fixture("signature.png"), signature_field
|
||||
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
|
||||
scenario 'creating a release for a minor with two guardians', js: true do
|
||||
project = create(:project, members: current_user, account: current_user.primary_account)
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
visit new_account_project_contract_template_material_release_path(project.account, project, contract_template)
|
||||
|
||||
expect(page).not_to have_content guardian_2_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_2_photo_heading.upcase
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading.upcase
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
expect(page).to have_content guardian_2_information_heading.upcase
|
||||
expect(page).to have_content guardian_2_photo_heading.upcase
|
||||
expect(page).to have_content guardian_2_phone_field.titleize
|
||||
|
||||
fill_all_fields
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
fill_in guardian_phone_field, with: '001101'
|
||||
fill_in guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
draw_signature file_fixture("signature.png"), signature_field
|
||||
|
||||
fill_in guardian_2_first_name_field, with: 'Second'
|
||||
fill_in guardian_2_last_name_field, with: 'Guardian'
|
||||
fill_in guardian_2_phone_field, with: '999'
|
||||
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
expect(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
|
||||
end
|
||||
|
||||
scenario "creating release is possible only after filling all fields", js: true do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
@@ -185,25 +98,7 @@ feature "User managing material releases" do
|
||||
sign_in current_user
|
||||
end
|
||||
|
||||
scenario "index table shows owner info" do
|
||||
release = create(:material_release, :native, :with_address, project: project)
|
||||
|
||||
visit project_material_releases_path(project)
|
||||
|
||||
expect(page).to have_content owner_info_table_header
|
||||
|
||||
expect(page).to have_content release.person_first_name
|
||||
expect(page).to have_content release.person_last_name
|
||||
expect(page).to have_content release.person_phone
|
||||
expect(page).to have_content release.person_email
|
||||
expect(page).to have_content release.person_address_street1
|
||||
expect(page).to have_content release.person_address_city
|
||||
expect(page).to have_content release.person_address_state
|
||||
expect(page).to have_content release.person_address_zip
|
||||
expect(page).to have_content release.person_address_country
|
||||
end
|
||||
|
||||
scenario "creating a release for and adult", js: true do
|
||||
scenario "creating a release", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
by "attaching only a contract" do
|
||||
@@ -225,94 +120,13 @@ feature "User managing material releases" do
|
||||
click_button create_release_button
|
||||
|
||||
expect(page).to have_content(create_release_notice)
|
||||
expect(page).to have_photo("material_photo.png", visible: :all)
|
||||
expect(page).to have_photo("material_photo.png")
|
||||
|
||||
click_on "Manage"
|
||||
expect(page).to have_link("Download")
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor - guardian fields are required when minor checkbox is checked", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'false'
|
||||
expect(field).not_to be_visible
|
||||
end
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
all('input[data-required-tag="guardian"]').each do |field|
|
||||
expect(field['required']).to eq 'true'
|
||||
expect(field).to be_visible
|
||||
end
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
expect(page).not_to have_content guardian_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_photo_heading
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
fill_in_release_fields name: "Apple Laptop"
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
fill_in guardian_phone_field, with: '001101'
|
||||
fill_in guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
click_button import_release_button
|
||||
|
||||
expect(page).to have_content successful_import_message
|
||||
expect(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
|
||||
end
|
||||
|
||||
scenario "creating a release for a minor with two guardians", js: true do
|
||||
visit new_project_material_release_path(project)
|
||||
|
||||
expect(page).not_to have_content guardian_2_information_heading.upcase
|
||||
expect(page).not_to have_content guardian_2_photo_heading
|
||||
|
||||
page.check person_is_minor_checkbox
|
||||
|
||||
expect(page).to have_content guardian_information_heading.upcase
|
||||
expect(page).to have_content guardian_photo_heading
|
||||
expect(page).to have_content guardian_email_field.titleize
|
||||
|
||||
expect(page).to have_content guardian_2_information_heading.upcase
|
||||
expect(page).to have_content guardian_2_photo_heading
|
||||
expect(page).to have_content guardian_2_phone_field.titleize
|
||||
|
||||
fill_in_release_fields name: "Apple Laptop"
|
||||
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
fill_in guardian_phone_field, with: '001101'
|
||||
fill_in guardian_email_field, with: 'valid@email.com'
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
fill_in_guardian_address_fields
|
||||
|
||||
fill_in guardian_2_first_name_field, with: 'Second'
|
||||
fill_in guardian_2_last_name_field, with: 'Guardian'
|
||||
fill_in guardian_2_phone_field, with: '999'
|
||||
|
||||
click_button import_release_button
|
||||
|
||||
expect(page).to have_content successful_import_message
|
||||
expect(MaterialRelease.last.guardian_first_name).to eq 'Guardian'
|
||||
expect(MaterialRelease.last.guardian_2_first_name).to eq 'Second'
|
||||
end
|
||||
|
||||
scenario "updating an existing release", js: true do
|
||||
material_release = create(:material_release, :non_native, project: project)
|
||||
|
||||
@@ -376,7 +190,7 @@ feature "User managing material releases" do
|
||||
click_on "Save Changes"
|
||||
|
||||
expect(page).to have_content("The release has been updated")
|
||||
expect(page).to have_photo("material_photo.png", visible: :all)
|
||||
expect(page).to have_photo("material_photo.png")
|
||||
end
|
||||
|
||||
scenario "viewing the contract PDF" do
|
||||
@@ -605,8 +419,8 @@ feature "User managing material releases" do
|
||||
"material_release[person_address_zip]"
|
||||
end
|
||||
|
||||
def have_photo(filename, visible: true)
|
||||
have_selector("img[src*='#{filename}']", visible: visible)
|
||||
def have_photo(filename)
|
||||
have_selector("img[src*='#{filename}']")
|
||||
end
|
||||
|
||||
def import_material_release_link(project)
|
||||
@@ -728,111 +542,4 @@ feature "User managing material releases" do
|
||||
def date_issued
|
||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
||||
end
|
||||
|
||||
def person_is_minor_checkbox
|
||||
'material_release_minor'
|
||||
end
|
||||
|
||||
def guardian_2_first_name_field
|
||||
t 'helpers.label.material_release.guardian_2_first_name'
|
||||
end
|
||||
|
||||
def guardian_2_last_name_field
|
||||
t 'helpers.label.material_release.guardian_2_last_name'
|
||||
end
|
||||
|
||||
def guardian_2_phone_field
|
||||
t 'helpers.label.material_release.guardian_2_phone'
|
||||
end
|
||||
|
||||
def guardian_first_name_field
|
||||
t 'helpers.label.material_release.guardian_first_name'
|
||||
end
|
||||
|
||||
def guardian_last_name_field
|
||||
t 'helpers.label.material_release.guardian_last_name'
|
||||
end
|
||||
|
||||
def guardian_phone_field
|
||||
t 'helpers.label.material_release.guardian_phone'
|
||||
end
|
||||
|
||||
def guardian_email_field
|
||||
t 'helpers.label.material_release.guardian_email'
|
||||
end
|
||||
|
||||
def guardian_address_street1_field
|
||||
t('helpers.label.material_release.guardian_address_street1')
|
||||
end
|
||||
|
||||
def guardian_address_city_field
|
||||
t('helpers.label.material_release.guardian_address_city')
|
||||
end
|
||||
|
||||
def guardian_address_state_field
|
||||
t('helpers.label.material_release.guardian_address_state')
|
||||
end
|
||||
|
||||
def guardian_address_zip_field
|
||||
t('helpers.label.material_release.guardian_address_zip')
|
||||
end
|
||||
|
||||
def guardian_photo_field
|
||||
'material_release[guardian_photo]'
|
||||
end
|
||||
|
||||
def guardian_2_photo_field
|
||||
'material_release[guardian_2_photo]'
|
||||
end
|
||||
|
||||
def fill_in_guardian_address_fields
|
||||
fill_in guardian_address_street1_field, with: "124 Test Lane"
|
||||
fill_in guardian_address_city_field, with: "New York"
|
||||
fill_in guardian_address_state_field, with: "NY"
|
||||
fill_in guardian_address_zip_field, with: '1000'
|
||||
end
|
||||
|
||||
def submit_release_button
|
||||
'I have read and agree to the above'
|
||||
end
|
||||
|
||||
def successful_submission_message
|
||||
'Your release was successfully submitted. Thank you.'
|
||||
end
|
||||
|
||||
def guardian_information_heading
|
||||
t 'public.material_releases.new.guardian_info.heading'
|
||||
end
|
||||
|
||||
def guardian_photo_heading
|
||||
t 'public.material_releases.new.guardian_photo.heading'
|
||||
end
|
||||
|
||||
def guardian_2_information_heading
|
||||
t 'public.material_releases.new.guardian_2_info.heading'
|
||||
end
|
||||
|
||||
def guardian_2_photo_heading
|
||||
t 'public.material_releases.new.guardian_2_photo.heading'
|
||||
end
|
||||
|
||||
def contract_field
|
||||
'material_release[contract]'
|
||||
end
|
||||
|
||||
def import_release_button
|
||||
t 'helpers.submit.material_release.create'
|
||||
end
|
||||
|
||||
def successful_import_message
|
||||
t 'material_releases.create.notice'
|
||||
end
|
||||
|
||||
def signature_field
|
||||
'material_release_signature_base64'
|
||||
end
|
||||
|
||||
def owner_info_table_header
|
||||
t 'material_releases.index.table_headers.owner_info'
|
||||
end
|
||||
end
|
||||
|
||||
@@ -148,18 +148,6 @@ RSpec.describe Account do
|
||||
end
|
||||
end
|
||||
|
||||
describe "#total_number_of_releases" do
|
||||
it "returns total number of releases" do
|
||||
account = create(:account)
|
||||
project = create(:project, account: account)
|
||||
appearance_release = create(:appearance_release, project: project)
|
||||
talent_release = create(:talent_release, project: project)
|
||||
material_release = create(:material_release, project: project)
|
||||
|
||||
expect(account.total_number_of_releases).to eq 3
|
||||
end
|
||||
end
|
||||
|
||||
describe "#me_suite_enabled?" do
|
||||
it "returns true when plan_uid is me_suite" do
|
||||
expect(build(:account, plan_uid: "me_suite").me_suite_enabled?).to eq true
|
||||
|
||||
@@ -49,36 +49,6 @@ RSpec.describe Broadcast, type: :model do
|
||||
expect(broadcast).to have_received(:destroy_mux_live_stream)
|
||||
end
|
||||
end
|
||||
|
||||
context "#stream_server_url" do
|
||||
it "returns mux stream url when overriden stream url is absent" do
|
||||
ENV["MUX_BROADCAST_SERVER_URL"] = "mux_stream"
|
||||
broadcast = create(:broadcast, :with_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_url).to eq("mux_stream")
|
||||
end
|
||||
|
||||
it "returns overriden stream url when it is present" do
|
||||
ENV["MUX_BROADCAST_SERVER_URL"] = "mux_stream"
|
||||
broadcast = create(:broadcast, :with_overriden_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_url).to eq("overriden_stream_url")
|
||||
end
|
||||
end
|
||||
|
||||
context "#stream_server_key" do
|
||||
it "returns mux stream key when overriden stream key is absent" do
|
||||
broadcast = create(:broadcast, :with_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_key).to eq("mux_key")
|
||||
end
|
||||
|
||||
it "returns overriden stream key when it is present" do
|
||||
broadcast = create(:broadcast, :with_overriden_stream, skip_create_callback: true, name: "My Broadcast")
|
||||
|
||||
expect(broadcast.stream_server_key).to eq("overriden_stream_key")
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe "#zoom_meeting_url" do
|
||||
|
||||
Reference in New Issue
Block a user