Upstream sync

This commit is contained in:
Senad Uka
2020-08-06 16:56:40 +00:00
parent 8214ba9e67
commit 190ff2854b
26 changed files with 383 additions and 83 deletions

View File

@@ -7,8 +7,6 @@ AWS_SECRET_ACCESS_KEY=
AWS_REGION= AWS_REGION=
BRAYNIAC_AI_API_ENDPOINT=https://z99cprg2eg.execute-api.us-east-1.amazonaws.com/dev/v0.0.1 BRAYNIAC_AI_API_ENDPOINT=https://z99cprg2eg.execute-api.us-east-1.amazonaws.com/dev/v0.0.1
SOURCE_AUDIO_API_ENDPOINT=https://bigmedia.sourceaudio.com/api
SOURCE_AUDIO_TOKEN=
# Optional # Optional
REDIS_URL= REDIS_URL=
@@ -16,7 +14,6 @@ REDIS_URL=
# Required for Zoom.us integration # Required for Zoom.us integration
ZOOM_API_KEY= ZOOM_API_KEY=
ZOOM_API_SECRET= ZOOM_API_SECRET=
ZOOM_ACCOUNT_NUMBER=
ZOOM_PRO_USERS_LIMIT= # defaults to 3 ZOOM_PRO_USERS_LIMIT= # defaults to 3
ZOOM_USER_TYPE= # 'pro' / 'basic' ZOOM_USER_TYPE= # 'pro' / 'basic'
ZOOM_ENABLE_RECORDINGS= # true / false (default: false) ZOOM_ENABLE_RECORDINGS= # true / false (default: false)
@@ -28,3 +25,7 @@ MUX_TOKEN_ID=
MUX_TOKEN_SECRET= MUX_TOKEN_SECRET=
MUX_BROADCAST_SERVER_URL=rtmp://global-live.mux.com:5222/app MUX_BROADCAST_SERVER_URL=rtmp://global-live.mux.com:5222/app
MUX_TEST_MODE_DISABLED= MUX_TEST_MODE_DISABLED=
# Required for creating user through API
CUSTOM_API_TOKEN=

View File

@@ -1,5 +1,12 @@
# frozen_string_literal: true
require './lib/knock_monkeypatch'
class Api::UserTokenController < Knock::AuthTokenController class Api::UserTokenController < Knock::AuthTokenController
include Oath::ControllerHelpers
skip_before_action :verify_authenticity_token skip_before_action :verify_authenticity_token
before_action :sign_in_user
rescue_from Exception, :with => :return_error rescue_from Exception, :with => :return_error
@@ -10,7 +17,7 @@ class Api::UserTokenController < Knock::AuthTokenController
logger.error "==Handled=======" logger.error "==Handled======="
logger.error exception.message logger.error exception.message
logger.error exception.backtrace.join("\n") logger.error exception.backtrace.join("\n")
logger.error "==Handled=======" logger.error "==Handled======="
case exception case exception
when ActiveRecord::RecordNotFound when ActiveRecord::RecordNotFound
@status = 404 @status = 404
@@ -27,12 +34,18 @@ class Api::UserTokenController < Knock::AuthTokenController
end end
# for some reason render json_errors is not working # for some reason render json_errors is not working
# simulating JSON API support # simulating JSON API support
render json: { render json: {
errors: [{ errors: [{
status: @status.to_s, status: @status.to_s,
title: @message title: @message
}] }]
} }
end end
private
def sign_in_user
sign_in(entity)
end
end end

View File

@@ -0,0 +1,33 @@
# frozen_string_literal: true
class Api::UsersController < Api::ApiController
skip_before_action :authenticate_user
before_action :verify_custom_token, only: :create
def create
if user_params[:email].nil? || user_params[:password].nil?
raise ActionController::ParameterMissing.new 'Missing email or password'
end
user = Oath::Services::SignUp.new(user_params).perform
render json: user.slice(:email, :created_at, :first_name, :last_name)
end
private
def user_params
params.require(:user).permit(%i[
email
password
first_name
last_name
])
end
def verify_custom_token
if token.blank? || token != ENV['CUSTOM_API_TOKEN']
unauthorized_entity(:user)
end
end
end

View File

@@ -64,6 +64,19 @@ class Account < ApplicationRecord
])).sum(:byte_size).to_f ])).sum(:byte_size).to_f
end end
def total_number_of_releases
[
MiscRelease.where(project: projects).size,
AppearanceRelease.where(project: projects).size,
TalentRelease.where(project: projects).size,
MaterialRelease.where(project: projects).size,
MedicalRelease.where(project: projects).size,
LocationRelease.where(project: projects).size,
AcquiredMediaRelease.where(project: projects).size,
MusicRelease.where(project: projects).size
].sum
end
def to_param def to_param
slug slug
end end
@@ -85,7 +98,7 @@ class Account < ApplicationRecord
end end
def taskme_enabled? def taskme_enabled?
ENV["TASKME_ENABLED"] && (plan_uid.to_s == "me_suite" || plan_uid.to_s == "taskme") plan_uid.to_s == "me_suite" || plan_uid.to_s == "taskme"
end end
def plan_name def plan_name

View File

@@ -1,4 +1,4 @@
<%= bootstrap_form_with model: account, url: account_path, html: { autocorrect: :off, autocapitalize: :none, autocomplete: :off, spellcheck: false }, layout: :inline, remote: true do |form| %> <%= bootstrap_form_with model: account, url: account_path, html: { autocorrect: :off, autocapitalize: :none, autocomplete: :off, spellcheck: false }, layout: :inline, remote: true do |form| %>
<%= form.file_field :logo, hide_label: true, accept: "image/*", placeholder: "Upload Logo", direct_upload: true, wrapper_class: "mr-1" %> <%= form.file_field :logo, hide_label: true, accept: "image/*", placeholder: "Upload Logo", direct_upload: true, wrapper_class: "mr-1", required: true %>
<%= form.button(fa_icon("upload", text: t(".submit")), class: "btn btn-md btn-primary", data: { disable_with: t("shared.disable_with") }) %> <%= form.button(fa_icon("upload", text: t(".submit")), class: "btn btn-md btn-primary", data: { disable_with: t("shared.disable_with") }) %>
<% end %> <% end %>

View File

@@ -18,6 +18,9 @@
<%= fa_icon("warning", text: t(".no_media"), class: "text-danger") %> <%= fa_icon("warning", text: t(".no_media"), class: "text-danger") %>
<% end %> <% end %>
</td> </td>
<td>
<%= contact_info_for(acquired_media_release.contact_person) %>
</td>
<td> <td>
<%= notes_preview acquired_media_release.notes.order_by_recent %> <%= notes_preview acquired_media_release.notes.order_by_recent %>
</td> </td>

View File

@@ -29,6 +29,7 @@
<th><%= t '.table_headers.approved'%></th> <th><%= t '.table_headers.approved'%></th>
<th><%= AcquiredMediaRelease.human_attribute_name(:name) %></th> <th><%= AcquiredMediaRelease.human_attribute_name(:name) %></th>
<th><%= t(".table_headers.file_infos_count") %></th> <th><%= t(".table_headers.file_infos_count") %></th>
<th><%= t(".table_headers.owner_info") %></th>
<th><%= t(".table_headers.notes") %></th> <th><%= t(".table_headers.notes") %></th>
<th><%= t(".table_headers.tags") %></th> <th><%= t(".table_headers.tags") %></th>
<th><%= t(".table_headers.signed_at") %></th> <th><%= t(".table_headers.signed_at") %></th>

View File

@@ -9,6 +9,8 @@
<dd class="col-sm-10"><%= @account.users.size %></dd> <dd class="col-sm-10"><%= @account.users.size %></dd>
<dt class="col-sm-2">Created at</dt> <dt class="col-sm-2">Created at</dt>
<dd class="col-sm-10"><%= time_ago_in_words(@account.created_at) %> ago</dd> <dd class="col-sm-10"><%= time_ago_in_words(@account.created_at) %> ago</dd>
<dt class="col-sm-2"># of Releases</dt>
<dd class="col-sm-10"><%= @account.total_number_of_releases %></dd>
</dl> </dl>
<% end %> <% end %>

View File

@@ -1,9 +1,9 @@
<% if broadcast.streamer_recording? && broadcast.active? %> <% if broadcast.director_mode_video_embed.present? && params[:director_mode].present? %>
<div id="broadcast_video" class="embed-responsive-item" data-video-type="stream"></div>
<% elsif broadcast.director_mode_video_embed.present? && params[:director_mode] == "true" %>
<div class="embed-responsive-item" data-video-type="stream"> <div class="embed-responsive-item" data-video-type="stream">
<%= raw broadcast.director_mode_video_embed %> <%= raw broadcast.director_mode_video_embed %>
</div> </div>
<% elsif broadcast.streamer_recording? && broadcast.active? %>
<div id="broadcast_video" class="embed-responsive-item" data-video-type="stream"></div>
<% else %> <% else %>
<div id="broadcast_video" class="embed-responsive-item" data-video-type="stream"> <div id="broadcast_video" class="embed-responsive-item" data-video-type="stream">
<table class="w-100 h-100 bg-secondary"> <table class="w-100 h-100 bg-secondary">

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<%= I18n.locale %>"> <html lang="<%= I18n.locale %>">
<head> <head>
<title>BiGMedia.ai App</title> <title>MESuite.ai App</title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>

View File

@@ -1,7 +1,7 @@
<!DOCTYPE html> <!DOCTYPE html>
<html lang="<%= I18n.locale %>"> <html lang="<%= I18n.locale %>">
<head> <head>
<title>BiGMedia.ai App</title> <title>MESuite.ai App</title>
<%= csrf_meta_tags %> <%= csrf_meta_tags %>
<%= csp_meta_tag %> <%= csp_meta_tag %>

View File

@@ -18,6 +18,9 @@
<td> <td>
<%= material_release.name %> <%= material_release.name %>
</td> </td>
<td>
<%= contact_info_for(material_release.contact_person) %>
</td>
<td> <td>
<%= notes_preview material_release.notes.order_by_recent %> <%= notes_preview material_release.notes.order_by_recent %>
</td> </td>

View File

@@ -29,10 +29,10 @@
<th><%= t '.table_headers.approved'%></th> <th><%= t '.table_headers.approved'%></th>
<th></th> <th></th>
<th><%= MaterialRelease.human_attribute_name(:name) %></th> <th><%= MaterialRelease.human_attribute_name(:name) %></th>
<th><%= t(".table_headers.owner_info") %>
<th><%= t(".table_headers.notes") %></th> <th><%= t(".table_headers.notes") %></th>
<th><%= t(".table_headers.tags") %></th> <th><%= t(".table_headers.tags") %></th>
<th><%= t(".table_headers.signed_at") %></th> <th><%= t(".table_headers.signed_at") %></th>
<th></th> <th></th>
</tr> </tr>
</thead> </thead>

View File

@@ -18,15 +18,7 @@
<div class="card-body p-0"> <div class="card-body p-0">
<div class="embed-responsive embed-responsive-16by9"> <div class="embed-responsive embed-responsive-16by9">
<div class="embed-responsive-item"> <div class="embed-responsive-item">
<table class="w-100 h-100 bg-secondary"> <div style="padding:56.25% 0 0 0;position:relative;"><iframe src="https://player.vimeo.com/video/444718363" style="position:absolute;top:0;left:0;width:100%;height:100%;" frameborder="0" allow="autoplay; fullscreen" allowfullscreen></iframe></div><script src="https://player.vimeo.com/api/player.js"></script>
<tbody>
<tr>
<td class="text-center align-middle text-white">
Video tutorial will be available soon
</td>
</tr>
</tbody>
</table>
</div> </div>
</div> </div>
</div> </div>

View File

@@ -67,6 +67,7 @@ en:
notes: Notes notes: Notes
signed_at: Date Signed signed_at: Date Signed
tags: Tags tags: Tags
owner_info: Owner Info
new: new:
heading: Import Acquired Media Release heading: Import Acquired Media Release
update: update:
@@ -518,6 +519,8 @@ en:
person_last_name: Last name person_last_name: Last name
person_name: Name person_name: Name
person_phone: Phone number person_phone: Phone number
contract_template:
amendment_clause: Additional Contract Clause
location_release: location_release:
address_city: City address_city: City
address_country: Country address_country: Country
@@ -848,7 +851,8 @@ en:
search: Search search: Search
empty: Location Releases will appear here empty: Location Releases will appear here
table_headers: table_headers:
amendment_signed: Amendment address: Address
amendment_signed: Additional Clause
approved: Approved approved: Approved
location_info: Location Info location_info: Location Info
notes: Notes notes: Notes
@@ -859,7 +863,7 @@ en:
actions: actions:
manage: Manage manage: Manage
review: Review review: Review
sign_amendment: Sign Amendment sign_amendment: Sign Additional Clause
messages: messages:
amendment_not_signed_tooltip: Amendment not yet signed amendment_not_signed_tooltip: Amendment not yet signed
amendment_signed_tooltip: Amendment Signed amendment_signed_tooltip: Amendment Signed
@@ -903,6 +907,7 @@ en:
approved: Approved approved: Approved
name: Name name: Name
notes: Notes notes: Notes
owner_info: Owner Info
signed_at: Date Signed signed_at: Date Signed
tags: Tags tags: Tags
material_release: material_release:
@@ -1141,7 +1146,7 @@ en:
amendment_signed_message: Release amendment signed successfully! Thank you amendment_signed_message: Release amendment signed successfully! Thank you
new: new:
amendment: amendment:
heading: Amendment heading: Additional Clause
copy_url: Copy sign amendment URL copy_url: Copy sign amendment URL
signature: signature:
heading: Signature heading: Signature

View File

@@ -21,6 +21,7 @@ es:
notes: Notes (ES) notes: Notes (ES)
signed_at: Date Signed (ES) signed_at: Date Signed (ES)
tags: Tags (ES) tags: Tags (ES)
owner_info: Owner Info (ES)
activerecord: activerecord:
attributes: attributes:
appearance_release: appearance_release:
@@ -285,6 +286,8 @@ es:
person_email: Dirección de correo electrónico person_email: Dirección de correo electrónico
person_name: Nómbre person_name: Nómbre
person_phone: Número de teléfono person_phone: Número de teléfono
contract_template:
amendment_clause: Additional Contract Clause (ES)
material_release: material_release:
guardian_2_address_city: Guardian 2 city (ES) guardian_2_address_city: Guardian 2 city (ES)
guardian_2_address_country: Guardian 2 country (ES) guardian_2_address_country: Guardian 2 country (ES)
@@ -408,13 +411,13 @@ es:
index: index:
table_headers: table_headers:
address: Address (ES) address: Address (ES)
amendment_signed: Amendment (ES) amendment_signed: Additional Clause (ES)
notes: Notes (ES) notes: Notes (ES)
signed_at: Date Signed (ES) signed_at: Date Signed (ES)
tags: Tags (ES) tags: Tags (ES)
location_release: location_release:
actions: actions:
sign_amendment: Sign Amendment (ES) sign_amendment: Sign Additional Clause (ES)
messages: messages:
amendment_not_signed_tooltip: Amendment not yet signed (ES) amendment_not_signed_tooltip: Amendment not yet signed (ES)
amendment_signed_tooltip: Amendment Signed (ES) amendment_signed_tooltip: Amendment Signed (ES)
@@ -436,6 +439,7 @@ es:
table_headers: table_headers:
name: Name (ES) name: Name (ES)
notes: Notes (ES) notes: Notes (ES)
owner_info: Owner Info
signed_at: Date Signed (ES) signed_at: Date Signed (ES)
tags: Tags (ES) tags: Tags (ES)
medical_releases: medical_releases:
@@ -500,7 +504,7 @@ es:
amendment_signed_message: Release amendment signed successfully! Thank you (ES) amendment_signed_message: Release amendment signed successfully! Thank you (ES)
new: new:
amendment: amendment:
heading: Amendment heading: Additional Clause (ES)
copy_url: Copy sign amendment URL (ES) copy_url: Copy sign amendment URL (ES)
signature: signature:
heading: Signature (ES) heading: Signature (ES)

View File

@@ -160,6 +160,7 @@ Rails.application.routes.draw do
scope 'v1' do scope 'v1' do
get 'sync' => 'sync#index' get 'sync' => 'sync#index'
post 'user_token' => 'user_token#create' post 'user_token' => 'user_token#create'
post 'users' => 'users#create'
resource :profiles, only: [:show] resource :profiles, only: [:show]
resources :projects, only: [:index] do resources :projects, only: [:index] do
resources :broadcasts, only: [:index, :show, :update] resources :broadcasts, only: [:index, :show, :update]

7
lib/knock_monkeypatch.rb Normal file
View File

@@ -0,0 +1,7 @@
module Knock
class AuthTokenController < ApplicationController
skip_before_action :authenticate
alias authenticate_with_token authenticate
before_action :authenticate_with_token
end
end

View File

@@ -0,0 +1,63 @@
# 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

View File

@@ -0,0 +1,78 @@
# 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

View File

@@ -4,6 +4,22 @@ FactoryBot.define do
name "Test Acquired Media Release" 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 trait :native do
signature do signature do
path = Rails.root.join("spec", "fixtures", "files", "signature.png") path = Rails.root.join("spec", "fixtures", "files", "signature.png")

View File

@@ -4,10 +4,20 @@ FactoryBot.define do
name "Test Materials" 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 trait :native do
person_first_name "Jane" person_first_name "Jane"
person_last_name "Doe" person_last_name "Doe"
person_phone "100-555-1001" person_phone "100-555-1001"
person_email "owner@email.com"
signature do signature do
path = Rails.root.join("spec", "fixtures", "files", "signature.png") path = Rails.root.join("spec", "fixtures", "files", "signature.png")

View File

@@ -165,6 +165,24 @@ feature "User managing acquired_media releases" do
sign_in current_user sign_in current_user
end 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 scenario "creating a release for an adult", js: true do
visit new_project_acquired_media_release_path(project) visit new_project_acquired_media_release_path(project)
@@ -262,62 +280,63 @@ feature "User managing acquired_media releases" do
end end
scenario "creating, updating, destroying a release", js: true do scenario "creating, updating, destroying a release", js: true do
release_data = { resize_window_to(1_000, 1_000) do
name: "Test Acquired Media Release", release_data = {
applicable_media: ApplicableMedium.last.label, name: "Test Acquired Media Release",
territory: Territory.last.label, applicable_media: ApplicableMedium.last.label,
term: Term.last.label, territory: Territory.last.label,
restriction: Restriction.first.label, term: Term.last.label,
restriction_text: "Not available in China", restriction: Restriction.first.label,
} restriction_text: "Not available in China",
}
sign_in current_user sign_in current_user
visit new_project_acquired_media_release_path(project) visit new_project_acquired_media_release_path(project)
by "attaching only a contract" do by "attaching only a contract" do
attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false attach_file contract_field, Rails.root.join(file_fixture("contract.pdf")), visible: false
click_button create_release_button 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 end
expect(page).to have_filled_in_data(release_data) by "attaching files" do
drop_file Rails.root.join(file_fixture("video_file.mp4")), type: "file-info-dropzone"
click_button create_release_button
fill_in_release_fields name: "New name" expect(page).to have_invalid_field(acquired_media_name_field)
drop_file Rails.root.join(file_fixture("person_photo.png")), type: "file-info-dropzone" end
click_button update_release_button
expect(page).to have_content(update_release_notice) by "filling out the remaining information" do
expect(page).to have_content("New name") fill_in_release_fields release_data
expect(page).to have_content("2") click_button create_release_button
end
it_also "deletes an existing release" do 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
click_button "Manage" click_button "Manage"
accept_alert do accept_alert do
click_link "Delete" click_link "Delete"
@@ -325,6 +344,7 @@ feature "User managing acquired_media releases" do
expect(page).not_to have_content("New name") expect(page).not_to have_content("New name")
end end
end
end end
scenario "viewing the contract PDF for an adult" do scenario "viewing the contract PDF for an adult" do
@@ -836,4 +856,8 @@ feature "User managing acquired_media releases" do
def successful_import_message def successful_import_message
t 'acquired_media_releases.create.notice' t 'acquired_media_releases.create.notice'
end end
def owner_info_table_header
t 'acquired_media_releases.index.table_headers.owner_info'
end
end end

View File

@@ -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) visit new_account_project_contract_template_location_release_amendment_path(project.account, project, contract_template, release)
expect(page).to have_content amendments_heading expect(page).to have_content amendments_heading.upcase
fill_in amendment_signer_name_field, with: 'Big Signer' fill_in amendment_signer_name_field, with: 'Big Signer'
draw_signature file_fixture("signature.png"), amendment_signature_field draw_signature file_fixture("signature.png"), amendment_signature_field
@@ -250,10 +250,7 @@ feature "User managing location releases" do
new_window = window_opened_by { click_link sign_amendment_link } new_window = window_opened_by { click_link sign_amendment_link }
within_window new_window do within_window new_window do
expect(page).to have_content amendments_heading expect(page).to have_content amendments_heading.upcase
expect(page).to have_content signed_contract_preview.upcase
expect(page).to have_selector 'embed'
fill_in amendment_signer_name_field, with: 'Big Signer' fill_in amendment_signer_name_field, with: 'Big Signer'
draw_signature file_fixture("signature.png"), amendment_signature_field draw_signature file_fixture("signature.png"), amendment_signature_field

View File

@@ -185,6 +185,24 @@ feature "User managing material releases" do
sign_in current_user sign_in current_user
end 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 for and adult", js: true do
visit new_project_material_release_path(project) visit new_project_material_release_path(project)
@@ -813,4 +831,8 @@ feature "User managing material releases" do
def signature_field def signature_field
'material_release_signature_base64' 'material_release_signature_base64'
end end
def owner_info_table_header
t 'material_releases.index.table_headers.owner_info'
end
end end

View File

@@ -148,6 +148,18 @@ RSpec.describe Account do
end end
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 describe "#me_suite_enabled?" do
it "returns true when plan_uid is me_suite" do it "returns true when plan_uid is me_suite" do
expect(build(:account, plan_uid: "me_suite").me_suite_enabled?).to eq true expect(build(:account, plan_uid: "me_suite").me_suite_enabled?).to eq true