Compare commits
4 Commits
make-all-f
...
add-guardi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
867260514e | ||
|
|
a5822a9556 | ||
|
|
96968b2adc | ||
|
|
25c4c73ad5 |
@@ -41,7 +41,7 @@ class Public::AppearanceReleasesController < Public::BaseController
|
||||
|
||||
def appearance_release_params
|
||||
params.require(:appearance_release).permit(:person_address, :person_first_name, :person_last_name, :person_phone, :person_email, :person_photo,
|
||||
:guardian_address, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_photo, :minor,
|
||||
:guardian_address, :guardian_first_name, :guardian_last_name, :guardian_phone, :guardian_email, :guardian_photo, :minor,
|
||||
:signature_base64, :person_date_of_birth,
|
||||
:locale, :contract_template,)
|
||||
end
|
||||
|
||||
@@ -39,6 +39,7 @@ class AppearanceRelease < ApplicationRecord
|
||||
# These validations apply to releases being signed by a minor
|
||||
with_options if: :minor? do
|
||||
validates :guardian_first_name, :guardian_last_name, presence: true
|
||||
validates :guardian_email, email: true, allow_blank: true
|
||||
end
|
||||
|
||||
validates :person_photo, content_type: face_photo_acceptable_content_types
|
||||
|
||||
@@ -36,12 +36,7 @@ class LocationRelease < ApplicationRecord
|
||||
validate :end_date_after_start_date
|
||||
|
||||
with_options on: :native do
|
||||
validates :address_street1, :address_city, :address_state, :address_zip, :address_country,
|
||||
:person_first_name, :person_last_name,
|
||||
:person_phone, :person_email, :person_company, :person_title,
|
||||
:person_address_street1, :person_address_city, :person_address_state,
|
||||
:person_address_zip, :person_address_country,
|
||||
:filming_started_on, :filming_ended_on, :filming_hours, presence: true
|
||||
validates :person_first_name, :person_last_name, presence: true
|
||||
validates :signature, attached: true
|
||||
end
|
||||
|
||||
|
||||
@@ -56,6 +56,7 @@
|
||||
<%= description_list_pair_for releasable, :guardian_name, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :guardian_address, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :guardian_phone, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :guardian_email, append: ":" %>
|
||||
<%= description_list_pair_for releasable, :signed_on, append: ":" %>
|
||||
</dl>
|
||||
|
||||
|
||||
@@ -76,6 +76,9 @@
|
||||
<%= form.text_field :guardian_last_name, required: @appearance_release.minor?, wrapper_class: "col-sm-3" %>
|
||||
<%= form.phone_field :guardian_phone, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :guardian_email, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :guardian_address, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
|
||||
@@ -17,21 +17,21 @@
|
||||
<div class="form-row">
|
||||
<%= form.text_field :name, required: true, wrapper_class: "col-12" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "", required: true %>
|
||||
<%= render "shared/address_fields", form: form, subject: "" %>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
|
||||
<%= card_field_set_tag t(".contact_info.heading") do %>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :person_first_name, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_last_name, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.phone_field :person_phone, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.email_field :person_email, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_company, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_title, required: true, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_first_name, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_last_name, wrapper_class: "col-sm-6" %>
|
||||
<%= form.phone_field :person_phone, wrapper_class: "col-sm-6" %>
|
||||
<%= form.email_field :person_email, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_company, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field :person_title, wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<%= render "shared/address_fields", form: form, subject: "person", required: true %>
|
||||
<%= render "shared/address_fields", form: form, subject: "person" %>
|
||||
<% end %>
|
||||
|
||||
<hr>
|
||||
@@ -39,9 +39,9 @@
|
||||
|
||||
<%= card_field_set_tag t(".filming_info.heading") do %>
|
||||
<div class="form-row">
|
||||
<%= form.text_field :filming_started_on, required: true, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_ended_on, required: true, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_hours, required: true, wrapper_class: "col-sm-12" %>
|
||||
<%= form.text_field :filming_started_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_ended_on, wrapper_class: "col-sm-6", class: "datepicker-control", readonly: true %>
|
||||
<%= form.text_field :filming_hours, wrapper_class: "col-sm-12" %>
|
||||
</div>
|
||||
<% end %>
|
||||
|
||||
|
||||
@@ -1,14 +1,13 @@
|
||||
<% field_name_prefix = subject.present? ? "#{subject}_" : "" %>
|
||||
<% required = required || false %>
|
||||
|
||||
<div class="form-row">
|
||||
<%= form.text_field "#{field_name_prefix}address_street1", required: required, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_street1", wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_street2", wrapper_class: "col-sm-6" %>
|
||||
</div>
|
||||
<div class="form-row">
|
||||
<%= form.text_field "#{field_name_prefix}address_city", required: required, wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_state", required: required, wrapper_class: "col-sm-3" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_zip", required: required, wrapper_class: "col-sm-3" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_city", wrapper_class: "col-sm-6" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_state", wrapper_class: "col-sm-3" %>
|
||||
<%= form.text_field "#{field_name_prefix}address_zip", wrapper_class: "col-sm-3" %>
|
||||
</div>
|
||||
<%= form.form_group "#{field_name_prefix}address_country" do %>
|
||||
<%= form.label "#{field_name_prefix}address_country" %>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
class AddGuardianEmailToAppearanceReleases < ActiveRecord::Migration[6.0]
|
||||
def change
|
||||
add_column :appearance_releases, :guardian_email, :string
|
||||
end
|
||||
end
|
||||
@@ -86,32 +86,10 @@ releases.each do |release|
|
||||
io: small_photo,
|
||||
filename: 'photo1.jpg'
|
||||
}]
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
if release[:type] == :location_release
|
||||
additional_params = {
|
||||
address_street1: 'Dummy St.',
|
||||
address_city: 'Dummy City',
|
||||
address_state: 'Dummy State',
|
||||
address_zip: '12121',
|
||||
address_country: 'US',
|
||||
person_email: 'mail@mail.com',
|
||||
person_company: 'Dummy Company Inc.',
|
||||
person_title: 'mr.',
|
||||
person_address_street1: 'Dummy St. 2',
|
||||
person_address_city: 'Dummy City 2',
|
||||
person_address_state: 'Dummy State 2',
|
||||
person_address_zip: '1111111',
|
||||
person_address_country: 'US',
|
||||
filming_ended_on: DateTime.now,
|
||||
filming_started_on: '01/02/20',
|
||||
filming_hours: '04-20'
|
||||
}
|
||||
|
||||
@parameters[release[:type]].merge!(additional_params)
|
||||
end
|
||||
|
||||
sign_in_to_api(current_user)
|
||||
end
|
||||
|
||||
|
||||
@@ -263,7 +263,10 @@ RSpec.describe AppearanceReleasesController, tye: :controller do
|
||||
end
|
||||
|
||||
def minor_appearance_release_params
|
||||
attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo).except(:contract).merge(contract_param, exploitable_rights_params)
|
||||
attributes_for(:appearance_release, :non_native, :minor_with_guardian_photo)
|
||||
.except(:contract)
|
||||
.except(:guardian_email)
|
||||
.merge(contract_param, exploitable_rights_params)
|
||||
end
|
||||
|
||||
def exploitable_rights_params
|
||||
|
||||
@@ -19,9 +19,9 @@ describe Public::LocationReleasesController do
|
||||
it "logs analytics" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect do
|
||||
expect {
|
||||
post :create, params: { account_id: project.account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params }
|
||||
end.to(
|
||||
}.to(
|
||||
have_enqueued_job(TrackAnalyticsJob)
|
||||
.with(nil, nil, :track_create_native_release, release_type: "LocationRelease", account: project.account, user_agent: "Rails Testing", user_ip: "0.0.0.0")
|
||||
)
|
||||
@@ -31,54 +31,28 @@ describe Public::LocationReleasesController do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
sign_in(user)
|
||||
|
||||
expect do
|
||||
post :create, params: {
|
||||
account_id: user.primary_account.to_param,
|
||||
project_id: project,
|
||||
contract_template_id: contract_template,
|
||||
location_release: attributes_for(:empty_location_release)
|
||||
}
|
||||
end.not_to change(LocationRelease, :count)
|
||||
post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, location_release: { person_address_city: "Albuquerque", filming_started_on: '02/02/02', filming_ended_on: '01/01/02' } }
|
||||
|
||||
body = CGI.unescape_html(response.body)
|
||||
expect(body).to match /Name can't be blank/
|
||||
expect(body).to match /Address street1 can't be blank/
|
||||
expect(body).to match /Address city can't be blank/
|
||||
expect(body).to match /Address state can't be blank/
|
||||
expect(body).to match /Address zip can't be blank/
|
||||
expect(body).to match /Address country can't be blank/
|
||||
expect(body).to match /Person first name can't be blank/
|
||||
expect(body).to match /Person last name can't be blank/
|
||||
expect(body).to match /Phone can't be blank/
|
||||
expect(body).to match /Email can't be blank/
|
||||
expect(body).to match /Company can't be blank/
|
||||
expect(body).to match /Title can't be blank/
|
||||
expect(body).to match /Person address street1 can't be blank/
|
||||
expect(body).to match /Person address city can't be blank/
|
||||
expect(body).to match /Person address state can't be blank/
|
||||
expect(body).to match /Person address zip can't be blank/
|
||||
expect(body).to match /Person address country can't be blank/
|
||||
expect(body).to match /Filming started on can't be blank/
|
||||
expect(body).to match /Filming ended on can't be blank/
|
||||
expect(body).to match /Filming hours can't be blank/
|
||||
expect(body).to match /Signature is not attached/
|
||||
expect(body).to match />can't be blank</
|
||||
# expect(body).to match /must be after the filming started on date/
|
||||
end
|
||||
|
||||
it "renders a success page" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect {
|
||||
post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params, filming_started_on: '01/02/20', filming_ended_on: '03/18/20' }
|
||||
}.to change(LocationRelease, :count).by(1)
|
||||
post :create, params: { account_id: user.primary_account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params, filming_started_on: '01/02/20', filming_ended_on: '03/18/20' }
|
||||
|
||||
expect(response).to be_successful
|
||||
end
|
||||
|
||||
it "runs set tags for releasable job" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect do
|
||||
expect {
|
||||
post :create, params: { account_id: project.account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params }
|
||||
end.to(
|
||||
}.to(
|
||||
have_enqueued_job(SetTagsForReleasableJob)
|
||||
.with(LocationRelease.last)
|
||||
)
|
||||
@@ -87,9 +61,9 @@ describe Public::LocationReleasesController do
|
||||
it "runs attach contract to releasable job" do
|
||||
contract_template = create(:contract_template, project: project)
|
||||
|
||||
expect do
|
||||
expect {
|
||||
post :create, params: { account_id: project.account.to_param, project_id: project, contract_template_id: contract_template, location_release: location_release_params }
|
||||
end.to(
|
||||
}.to(
|
||||
have_enqueued_job(AttachContractToReleasableJob)
|
||||
.with(LocationRelease.last)
|
||||
)
|
||||
@@ -99,11 +73,11 @@ describe Public::LocationReleasesController do
|
||||
private
|
||||
|
||||
def location_release_params
|
||||
attributes_for(:location_release, :full_native).except(:signature).merge(signature_param).merge(person_address_params)
|
||||
attributes_for(:location_release, :native).except(:signature).merge(signature_param).merge(person_address_params)
|
||||
end
|
||||
|
||||
def location_release_params_with_photos
|
||||
attributes_for(:location_release, :full_native, :with_photo).except(:signature).merge(signature_param)
|
||||
attributes_for(:location_release, :native, :with_photo).except(:signature).merge(signature_param)
|
||||
end
|
||||
|
||||
def person_address_params
|
||||
|
||||
@@ -33,6 +33,7 @@ FactoryBot.define do
|
||||
guardian_last_name "Doe"
|
||||
guardian_address "100 Test Lane, New York, 10001"
|
||||
guardian_phone "123-555-1234"
|
||||
guardian_email "guardian@galaxy.all"
|
||||
end
|
||||
|
||||
trait :minor_with_guardian_photo do
|
||||
@@ -41,6 +42,7 @@ FactoryBot.define do
|
||||
guardian_last_name "Doe"
|
||||
guardian_address "100 Test Lane, New York, 10001"
|
||||
guardian_phone "123-555-1234"
|
||||
guardian_email "guardian@galaxy.all"
|
||||
guardian_photo do
|
||||
path = Rails.root.join("spec", "fixtures", "files", "pratt.jpg")
|
||||
Rack::Test::UploadedFile.new(path, "image/jpeg")
|
||||
|
||||
@@ -29,32 +29,6 @@ FactoryBot.define do
|
||||
end
|
||||
end
|
||||
|
||||
trait :full_native do
|
||||
address_street1 'Dummy St.'
|
||||
address_city 'Dummy City'
|
||||
address_state 'Dummy State'
|
||||
address_zip '12121'
|
||||
address_country 'US'
|
||||
person_first_name 'John'
|
||||
person_last_name 'Doe'
|
||||
person_phone '222223333'
|
||||
person_email 'mail@mail.com'
|
||||
person_company 'Dummy Company Inc.'
|
||||
person_title 'mr.'
|
||||
person_address_street1 'Dummy St. 2'
|
||||
person_address_city 'Dummy City 2'
|
||||
person_address_state 'Dummy State 2'
|
||||
person_address_zip '1111111'
|
||||
person_address_country 'US'
|
||||
filming_ended_on DateTime.now
|
||||
filming_started_on '01/02/20'
|
||||
filming_hours '04-20'
|
||||
end
|
||||
|
||||
factory :empty_location_release do
|
||||
name nil
|
||||
end
|
||||
|
||||
factory :location_release_with_contract_template do
|
||||
after(:build) do |location_release, _|
|
||||
location_release.contract_template = build(:location_release_contract_template)
|
||||
|
||||
@@ -25,7 +25,7 @@ feature 'User managing appearance releases' do
|
||||
fill_in person_date_of_birth, with: '01/01/1999'
|
||||
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button 'I have read and agree to the above'
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
@@ -45,6 +45,7 @@ feature 'User managing appearance releases' do
|
||||
page.check person_is_minor_checkbox
|
||||
expect(page).to have_content('GUARDIAN INFORMATION')
|
||||
expect(page).to have_content('GUARDIAN PHOTO')
|
||||
expect(page).to have_content 'Guardian Email'
|
||||
|
||||
fill_in guardian_first_name_field, with: 'Guardian'
|
||||
fill_in guardian_last_name_field, with: 'Name'
|
||||
@@ -58,7 +59,14 @@ feature 'User managing appearance releases' do
|
||||
attach_file person_photo_field, file_fixture('person_photo.png'), visible: :all
|
||||
attach_file guardian_photo_field, file_fixture('hemsworth.jpeg'), visible: :all
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button 'I have read and agree to the above'
|
||||
|
||||
fill_in guardian_email_field, with: 'invalid@email'
|
||||
click_button submit_release_button
|
||||
expect(page).to have_content('Guardian email is not an email')
|
||||
|
||||
fill_in guardian_email_field, with: 'valid@email.com'
|
||||
draw_signature file_fixture('signature.png'), 'appearance_release_signature_base64'
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content(successful_submission_message)
|
||||
end
|
||||
@@ -249,6 +257,7 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_body).to have_content('TAGS')
|
||||
expect(pdf_body).to have_content('Woman')
|
||||
expect(pdf_body).to have_content('Brunette')
|
||||
expect(pdf_body).not_to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'viewing contract PDF for a minor without guardian photo' do
|
||||
@@ -262,8 +271,10 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
|
||||
expect(pdf_body).to have_content(appearance_release.name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_email)
|
||||
expect(pdf_body).to have_content photos_heading.upcase
|
||||
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
|
||||
expect(pdf_body).to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'viewing contract PDF for a minor with guardian photo' do
|
||||
@@ -277,9 +288,11 @@ feature 'User managing appearance releases' do
|
||||
expect(pdf_filename).to include(appearance_release.filename_suffix.parameterize)
|
||||
expect(pdf_body).to have_content(appearance_release.name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_name)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_email)
|
||||
expect(pdf_body).to have_content photos_heading(2).upcase
|
||||
expect(pdf_body).to have_content(appearance_release.photo.filename.to_s)
|
||||
expect(pdf_body).to have_content(appearance_release.guardian_photo.filename.to_s)
|
||||
expect(pdf_body).to have_content('Guardian Email')
|
||||
end
|
||||
|
||||
scenario 'deleting a release', js: true do
|
||||
@@ -470,6 +483,10 @@ feature 'User managing appearance releases' do
|
||||
'Guardian phone'
|
||||
end
|
||||
|
||||
def guardian_email_field
|
||||
'Guardian email'
|
||||
end
|
||||
|
||||
def guardian_photo_field
|
||||
'appearance_release[guardian_photo]'
|
||||
end
|
||||
@@ -518,6 +535,10 @@ feature 'User managing appearance releases' do
|
||||
'Import Release'
|
||||
end
|
||||
|
||||
def submit_release_button
|
||||
'I have read and agree to the above'
|
||||
end
|
||||
|
||||
def submit_update_button
|
||||
'Save Changes'
|
||||
end
|
||||
|
||||
@@ -17,16 +17,20 @@ feature "User managing location releases" do
|
||||
|
||||
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
|
||||
|
||||
click_button submit_release_button
|
||||
expect(page).not_to have_content submitted_release_notice
|
||||
|
||||
by "filling out the form" do
|
||||
fill_all_form_fields
|
||||
fill_in location_name_field, with: "Benny's Burritos"
|
||||
fill_in person_first_name_field, with: "Jane"
|
||||
fill_in person_last_name_field, with: "Doe"
|
||||
fill_in person_phone_field, with: "555-555-5555"
|
||||
fill_in person_email_field, with: "jane.doe@test.com"
|
||||
fill_in person_address_street1_field, with: "100 Broadway"
|
||||
fill_in filming_hours_field, with: "04:00 - 22:00"
|
||||
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
|
||||
end
|
||||
|
||||
click_button submit_release_button
|
||||
|
||||
expect(page).to have_content submitted_release_notice
|
||||
expect(page).to have_content("Your release was successfully submitted. Thank you.")
|
||||
end
|
||||
|
||||
scenario "creating a release with photos", js: true do
|
||||
@@ -34,7 +38,15 @@ feature "User managing location releases" do
|
||||
|
||||
visit new_account_project_contract_template_location_release_path(project.account, project, contract_template)
|
||||
|
||||
fill_all_form_fields
|
||||
fill_in location_name_field, with: "Benny's Burritos"
|
||||
fill_in person_first_name_field, with: "Jane"
|
||||
fill_in person_last_name_field, with: "Doe"
|
||||
fill_in person_phone_field, with: "555-555-5555"
|
||||
fill_in person_email_field, with: "jane.doe@test.com"
|
||||
fill_in person_address_street1_field, with: "100 Broadway"
|
||||
fill_in filming_hours_field, with: "04:00 - 22:00"
|
||||
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
|
||||
|
||||
drop_file Rails.root.join(file_fixture("location_photo.png")), type: :dropzone
|
||||
click_button submit_release_button
|
||||
|
||||
@@ -211,29 +223,6 @@ feature "User managing location releases" do
|
||||
|
||||
private
|
||||
|
||||
def fill_all_form_fields
|
||||
fill_in location_name_field, with: "Benny's Burritos"
|
||||
fill_in address_street1_field, with: "100 Broadway"
|
||||
fill_in address_city_field, with: "D"
|
||||
fill_in address_state_field, with: "CA"
|
||||
fill_in address_zip_field, with: "123"
|
||||
fill_in person_first_name_field, with: "Jane"
|
||||
fill_in person_last_name_field, with: "Doe"
|
||||
fill_in person_phone_field, with: "555-555-5555"
|
||||
fill_in person_email_field, with: "jane.doe@test.com"
|
||||
fill_in person_company_field, with: "Inc"
|
||||
fill_in person_title_field, with: "Mrs."
|
||||
fill_in person_address_street1_field, with: "100 Broadway"
|
||||
fill_in person_address_city_field, with: "D"
|
||||
fill_in person_address_state_field, with: "CA"
|
||||
fill_in person_address_zip_field, with: "123"
|
||||
fill_filming_started_on_field
|
||||
fill_filming_ended_on_field
|
||||
fill_in filming_hours_field, with: "04:00 - 22:00"
|
||||
|
||||
draw_signature file_fixture("signature.png"), "location_release_signature_base64"
|
||||
end
|
||||
|
||||
def country_field_value
|
||||
find_field("location_release[person_address_country]").value
|
||||
end
|
||||
@@ -262,66 +251,14 @@ feature "User managing location releases" do
|
||||
"location_release[person_email]"
|
||||
end
|
||||
|
||||
def person_company_field
|
||||
"location_release[person_company]"
|
||||
end
|
||||
|
||||
def person_title_field
|
||||
"location_release[person_title]"
|
||||
end
|
||||
|
||||
def address_street1_field
|
||||
"location_release[address_street1]"
|
||||
end
|
||||
|
||||
def address_city_field
|
||||
"location_release[address_city]"
|
||||
end
|
||||
|
||||
def address_state_field
|
||||
"location_release[address_state]"
|
||||
end
|
||||
|
||||
def address_zip_field
|
||||
"location_release[address_zip]"
|
||||
end
|
||||
|
||||
def address_country_field
|
||||
"location_release[address_country]"
|
||||
end
|
||||
|
||||
def person_address_street1_field
|
||||
"location_release[person_address_street1]"
|
||||
end
|
||||
|
||||
def person_address_city_field
|
||||
"location_release[person_address_city]"
|
||||
end
|
||||
|
||||
def person_address_state_field
|
||||
"location_release[person_address_state]"
|
||||
end
|
||||
|
||||
def person_address_zip_field
|
||||
"location_release[person_address_zip]"
|
||||
end
|
||||
|
||||
def person_address_country_field
|
||||
"location_release[person_address_country]"
|
||||
end
|
||||
|
||||
def person_phone_field
|
||||
"location_release[person_phone]"
|
||||
end
|
||||
|
||||
def fill_filming_started_on_field
|
||||
page.execute_script("$('#location_release_filming_started_on').val('01/03/20')")
|
||||
end
|
||||
|
||||
def fill_filming_ended_on_field
|
||||
page.execute_script("$('#location_release_filming_ended_on').val('03/03/20')")
|
||||
end
|
||||
|
||||
def filming_hours_field
|
||||
"location_release[filming_hours]"
|
||||
end
|
||||
@@ -354,10 +291,6 @@ feature "User managing location releases" do
|
||||
t("shared.submit_release_long")
|
||||
end
|
||||
|
||||
def submitted_release_notice
|
||||
"Your release was successfully submitted. Thank you."
|
||||
end
|
||||
|
||||
def create_release_notice
|
||||
t "location_releases.create.notice"
|
||||
end
|
||||
|
||||
@@ -13,27 +13,7 @@ RSpec.describe LocationRelease do
|
||||
end
|
||||
|
||||
describe "validations" do
|
||||
it { is_expected.to validate_presence_of(:name).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_street1).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_city).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_state).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_zip).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:address_country).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_first_name).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_last_name).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_phone).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_email).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_company).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_title).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_street1).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_city).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_state).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_zip).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:person_address_country).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:filming_ended_on).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:filming_started_on).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:filming_hours).on(:native) }
|
||||
it { is_expected.to validate_attachment_of(:signature).on(:native) }
|
||||
it { is_expected.to validate_presence_of(:name) }
|
||||
it { is_expected.to allow_value("test@test.com", nil).for(:person_email) }
|
||||
it { is_expected.not_to allow_values("foo", "test@foo", "N/A").for(:person_email) }
|
||||
|
||||
|
||||
@@ -150,49 +150,9 @@ describe "IOS App Support API" do
|
||||
expect(response.body).to match /Person/
|
||||
end
|
||||
|
||||
it 'creates location release' do
|
||||
release = releases.third
|
||||
release_json = { "data" => {
|
||||
"type" => "location_release",
|
||||
"attributes" => {
|
||||
"name" => "Test Premises",
|
||||
"address_street1" => "Dummy St.",
|
||||
"address_city" => "Dummy City",
|
||||
"address_state" => "Dummy State",
|
||||
"address_zip" => "12121",
|
||||
"address_country" => "US",
|
||||
"person_first_name" => "John",
|
||||
"person_last_name" => "Doe",
|
||||
"person_phone" => "222223333",
|
||||
"person_email" => "mail@mail.com",
|
||||
"person_company" => "Dummy Company Inc.",
|
||||
"person_title" => "mr.",
|
||||
"person_address_street1" => "Dummy St. 2",
|
||||
"person_address_city" => "Dummy City 2",
|
||||
"person_address_state" => "Dummy State 2",
|
||||
"person_address_zip" => "1111111",
|
||||
"person_address_country" => "US",
|
||||
"filming_ended_on" => DateTime.now,
|
||||
"filming_started_on" => "01/02/20",
|
||||
"filming_hours" => "04-20",
|
||||
"signature" => "#{signature_base64}"
|
||||
}
|
||||
} }.to_json
|
||||
|
||||
post "/api/v1/contract_templates/#{template.id}/#{release[:type].to_s.pluralize}", params: release_json, headers: required_headers(current_user)
|
||||
|
||||
json = JSON.parse(response.body)
|
||||
|
||||
expect(response.status).to eq 201
|
||||
expect(json["data"]["attributes"].keys.length).to be > 1
|
||||
expect(response.body).to match /John/
|
||||
expect(response.body).to match /Doe/
|
||||
end
|
||||
|
||||
it 'creates talent, material and location releases' do
|
||||
releases.each do |release|
|
||||
next if release[:type] == :appearance_release
|
||||
next if release[:type] == :location_release
|
||||
|
||||
release_json = { "data" => {
|
||||
"type" => release[:type].to_s,
|
||||
|
||||
Reference in New Issue
Block a user