Upstream sync
This commit is contained in:
@@ -6,9 +6,12 @@ class ApprovalsController < ApplicationController
|
|||||||
|
|
||||||
def create
|
def create
|
||||||
@releasable.approve_by(current_user)
|
@releasable.approve_by(current_user)
|
||||||
|
@releasable.approved_by_user_signature.attach(approved_by_user_signature_params) if signature_data.present?
|
||||||
|
|
||||||
if @releasable.save
|
if @releasable.save(context: :approval)
|
||||||
redirect_to [@project, "#{@releasable_param.name.pluralize}"], notice: t('.release_approved', release_type: @releasable.model_name.human)
|
redirect_to [@project, "#{@releasable_param.name.pluralize}"], notice: t('.release_approved', release_type: @releasable.model_name.human)
|
||||||
|
else
|
||||||
|
render :new
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
@@ -25,4 +28,21 @@ class ApprovalsController < ApplicationController
|
|||||||
def set_project
|
def set_project
|
||||||
@project = @releasable.project
|
@project = @releasable.project
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def releasable_params
|
||||||
|
params.require(releasable_param.name).permit(approved_by_user_signature: :data)
|
||||||
|
end
|
||||||
|
|
||||||
|
def signature_data
|
||||||
|
releasable_params.dig(:approved_by_user_signature, :data)
|
||||||
|
end
|
||||||
|
|
||||||
|
def approved_by_user_signature_params
|
||||||
|
{
|
||||||
|
data: signature_data,
|
||||||
|
filename: "approved_by_user_signature.png",
|
||||||
|
content_type: "image/png",
|
||||||
|
identify: false,
|
||||||
|
}
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,15 +1,24 @@
|
|||||||
module Approvable
|
module Approvable
|
||||||
extend ActiveSupport::Concern
|
extend ActiveSupport::Concern
|
||||||
|
|
||||||
included do
|
included do
|
||||||
|
include ActiveStorageSupport::SupportForBase64
|
||||||
|
|
||||||
|
has_one_base64_attached :approved_by_user_signature
|
||||||
|
|
||||||
|
# Requires signature when saving in the approval context
|
||||||
|
with_options on: :approval do
|
||||||
|
validates :approved_by_user_signature, attached: true
|
||||||
|
end
|
||||||
|
|
||||||
def approve_by(user)
|
def approve_by(user)
|
||||||
return unless approved_at.nil?
|
return unless approved_at.nil?
|
||||||
|
|
||||||
self.approved_by_user_name = user.full_name
|
self.approved_by_user_name = user.full_name
|
||||||
self.approved_by_user_email = user.email
|
self.approved_by_user_email = user.email
|
||||||
self.approved_at = Time.zone.now
|
self.approved_at = BigMediaTime.time_zone_now
|
||||||
end
|
end
|
||||||
|
|
||||||
def approved?
|
def approved?
|
||||||
self.approved_at.present?
|
self.approved_at.present?
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,9 +1,13 @@
|
|||||||
<div class="card shadow-sm">
|
<div class="card shadow-sm">
|
||||||
<%= card_header text: t(".heading", release_type: @releasable_param.name.titleize), close_action_path: [@project, "#{@releasable_param.name.pluralize}"] %>
|
<%= card_header text: t(".heading", release_type: @releasable_param.name.titleize), close_action_path: [@project, "#{@releasable_param.name.pluralize}"] %>
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<embed class="embeded-contract-preview" type="application/pdf" src="<%= url_for [@releasable, :contracts, format: "pdf"] %>" width="90%" height="1200" />
|
<embed class="embeded-contract-preview mb-3" type="application/pdf" src="<%= url_for [@releasable, :contracts, format: "pdf"] %>" width="90%" height="1200" />
|
||||||
|
|
||||||
|
<%= errors_summary_for @releasable %>
|
||||||
<%= bootstrap_form_with model: @releasable, method: :post, url: public_send("#{@releasable_param.name}_approvals_path", @releasable), local: true do |form| %>
|
<%= bootstrap_form_with model: @releasable, method: :post, url: public_send("#{@releasable_param.name}_approvals_path", @releasable), local: true do |form| %>
|
||||||
|
<%= card_field_set_tag 'Signature' do %>
|
||||||
|
<%= render "shared/signature_fields", form: form, signature_field: 'approved_by_user_signature[data]' %>
|
||||||
|
<% end %>
|
||||||
<div class="row align-items-center text-center mt-4">
|
<div class="row align-items-center text-center mt-4">
|
||||||
<%= link_to t("shared.cancel"), [@releasable.project, "#{@releasable_param.name.pluralize}"], class: "col-3 text-reset" %>
|
<%= link_to t("shared.cancel"), [@releasable.project, "#{@releasable_param.name.pluralize}"], class: "col-3 text-reset" %>
|
||||||
<div class="col-9">
|
<div class="col-9">
|
||||||
@@ -12,4 +16,4 @@
|
|||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -10,4 +10,10 @@
|
|||||||
<%= description_list_pair t('.description_labels.issued_to'), releasable.name %>
|
<%= description_list_pair t('.description_labels.issued_to'), releasable.name %>
|
||||||
<%= description_list_pair t('.description_labels.issued_by'), releasable.approved_by_user_name %>
|
<%= description_list_pair t('.description_labels.issued_by'), releasable.approved_by_user_name %>
|
||||||
<%= description_list_pair t('.description_labels.date_issued'), releasable.approved_at %>
|
<%= description_list_pair t('.description_labels.date_issued'), releasable.approved_at %>
|
||||||
</dl>
|
</dl>
|
||||||
|
|
||||||
|
<% if preview %>
|
||||||
|
<%= image_tag dummy_signature %>
|
||||||
|
<% elsif releasable.approved_by_user_signature.attached? %>
|
||||||
|
<%= image_tag releasable.approved_by_user_signature.variant(auto_orient: true, resize: "200x200") %>
|
||||||
|
<% end %>
|
||||||
|
|||||||
@@ -16,11 +16,10 @@
|
|||||||
<%= contract_template.guardian_clause %>
|
<%= contract_template.guardian_clause %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<%# if releasable.model_name.in? %w(MedicalRelease MiscRelease AppearanceRelease) %>
|
|
||||||
<% if releasable.respond_to?(:question_1_answer) %>
|
<% if releasable.respond_to?(:question_1_answer) %>
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<%= render "contracts/questionnaire", releasable: releasable, contract_template: contract_template, preview: preview %>
|
<%= render "contracts/questionnaire", releasable: releasable, contract_template: contract_template, preview: preview %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
@@ -47,8 +46,7 @@
|
|||||||
<% end %>
|
<% end %>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
||||||
|
<% if releasable.try(:approved?) %>
|
||||||
<% if releasable.respond_to?(:approved?) && releasable.approved? %>
|
|
||||||
<div class="page">
|
<div class="page">
|
||||||
<%= render "contracts/for_office_use_only", releasable: releasable, preview: preview %>
|
<%= render "contracts/for_office_use_only", releasable: releasable, preview: preview %>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
@@ -27,10 +27,17 @@ RSpec.describe ApprovalsController, type: :controller do
|
|||||||
|
|
||||||
expect(MedicalRelease.last.approved?).to eq false
|
expect(MedicalRelease.last.approved?).to eq false
|
||||||
|
|
||||||
post :create, params: { medical_release_id: medical_release }
|
post :create, params: { medical_release_id: medical_release, medical_release: approvable_params }
|
||||||
|
|
||||||
expect(response).to redirect_to [project, :medical_releases]
|
expect(response).to redirect_to [project, :medical_releases]
|
||||||
expect(MedicalRelease.last.approved?).to eq true
|
expect(MedicalRelease.last.approved?).to eq true
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def approvable_params
|
||||||
|
signature_base64 ||= Base64Image.from_image(file_fixture('signature.png')).data_uri
|
||||||
|
{ approved_by_user_signature: { data: signature_base64 } }
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
191
spec/features/user_approving_releasables_spec.rb
Normal file
191
spec/features/user_approving_releasables_spec.rb
Normal file
@@ -0,0 +1,191 @@
|
|||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
feature 'User approving releasables' do
|
||||||
|
shared_examples 'an approvable UI' do
|
||||||
|
let(:current_user) { create(:user, :associate) }
|
||||||
|
let(:project) { create(:project, members: current_user, account: current_user.primary_account) }
|
||||||
|
|
||||||
|
before :each do
|
||||||
|
sign_in current_user
|
||||||
|
end
|
||||||
|
|
||||||
|
shared_examples 'not authorized to review' do
|
||||||
|
it 'does not show the review action' do
|
||||||
|
visit polymorphic_path [project, subject.model_name.plural]
|
||||||
|
click_on manage_button
|
||||||
|
|
||||||
|
expect(page).not_to have_link(review_action, exact: true)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'approval status is indicating by a checkmark' do
|
||||||
|
approved_releasable = create("#{subject.model_name.singular}", approved_at: 1.day.ago, project: project)
|
||||||
|
|
||||||
|
visit polymorphic_path [project, subject.model_name.plural]
|
||||||
|
|
||||||
|
expect(page).not_to be_approved(subject)
|
||||||
|
expect(page).not_to be_approved(approved_releasable)
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'as an account manager' do
|
||||||
|
let(:current_user) { create(:user, :account_manager) }
|
||||||
|
|
||||||
|
scenario 'approving a release', js: true do
|
||||||
|
visit polymorphic_path [project, subject.model_name.plural]
|
||||||
|
|
||||||
|
click_on manage_button
|
||||||
|
click_link review_action
|
||||||
|
|
||||||
|
expect(page).to have_content review_page_heading(subject.model_name)
|
||||||
|
expect(page).to have_content approve_button
|
||||||
|
expect(page).to have_content signature_field
|
||||||
|
|
||||||
|
click_on approve_button
|
||||||
|
|
||||||
|
expect(page).not_to have_content approved_notice(subject.model_name)
|
||||||
|
expect(page).to have_content 'is not attached'
|
||||||
|
|
||||||
|
by 'adding signature' do
|
||||||
|
draw_signature file_fixture('signature.png'), signature_data_field(subject.model_name)
|
||||||
|
click_on approve_button
|
||||||
|
|
||||||
|
expect(page).to have_content approved_notice(subject.model_name)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'viewing the contract PDF for an unapproved release' do
|
||||||
|
visit polymorphic_path [project, subject.model_name.plural]
|
||||||
|
click_on 'Manage'
|
||||||
|
click_link 'Download'
|
||||||
|
|
||||||
|
expect(content_type).to eq('application/pdf')
|
||||||
|
expect(content_disposition).to include('inline')
|
||||||
|
expect(pdf_body).not_to have_content for_office_use_only
|
||||||
|
end
|
||||||
|
|
||||||
|
scenario 'viewing the contract PDF of an approved release' do
|
||||||
|
approver = create(:user, email: 'big.doe@test.com', first_name: 'Big', last_name: 'Joe')
|
||||||
|
subject.approve_by(approver)
|
||||||
|
subject.save!
|
||||||
|
|
||||||
|
visit polymorphic_path([subject, :contracts], format: 'pdf')
|
||||||
|
|
||||||
|
expect(content_type).to eq('application/pdf')
|
||||||
|
expect(content_disposition).to include('inline')
|
||||||
|
expect(pdf_body).to have_content for_office_use_only.upcase
|
||||||
|
expect(pdf_body).to have_content producer_label
|
||||||
|
expect(pdf_body).to have_content production_label
|
||||||
|
expect(pdf_body).to have_content issued_to_label
|
||||||
|
expect(pdf_body).to have_content issued_by_label
|
||||||
|
expect(pdf_body).to have_content date_issued
|
||||||
|
expect(pdf_body).to have_content 'Big Joe'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'as a manager' do
|
||||||
|
let(:current_user) { create(:user, :manager) }
|
||||||
|
|
||||||
|
include_examples 'not authorized to review'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'as an associate' do
|
||||||
|
let(:current_user) { create(:user, :associate) }
|
||||||
|
|
||||||
|
include_examples 'not authorized to review'
|
||||||
|
end
|
||||||
|
|
||||||
|
private
|
||||||
|
|
||||||
|
def approve_button
|
||||||
|
t 'approvals.new.actions.approve'
|
||||||
|
end
|
||||||
|
|
||||||
|
def approved_notice(model_name)
|
||||||
|
t('approvals.create.release_approved', release_type: model_name.human)
|
||||||
|
end
|
||||||
|
|
||||||
|
def be_approved(releasable)
|
||||||
|
releasable_dom_id = "##{releasable.model_name.singular}_#{releasable.id}"
|
||||||
|
have_css("#{releasable_dom_id }i.fa.fa-check-circle.fa-2x", count: 1)
|
||||||
|
end
|
||||||
|
|
||||||
|
def manage_button
|
||||||
|
'Manage'
|
||||||
|
end
|
||||||
|
|
||||||
|
def review_action
|
||||||
|
'Review'
|
||||||
|
end
|
||||||
|
|
||||||
|
def review_page_heading(model_name)
|
||||||
|
t 'approvals.new.heading', release_type: model_name.human.titleize
|
||||||
|
end
|
||||||
|
|
||||||
|
def signature_field
|
||||||
|
'SIGNATURE'
|
||||||
|
end
|
||||||
|
|
||||||
|
def signature_data_field(model_name)
|
||||||
|
"#{model_name.singular}_approved_by_user_signature[data]"
|
||||||
|
end
|
||||||
|
|
||||||
|
def for_office_use_only
|
||||||
|
t('contracts.for_office_use_only.heading').upcase
|
||||||
|
end
|
||||||
|
|
||||||
|
def producer_label
|
||||||
|
t 'contracts.for_office_use_only.description_labels.producer'
|
||||||
|
end
|
||||||
|
|
||||||
|
def production_label
|
||||||
|
t 'contracts.for_office_use_only.description_labels.production'
|
||||||
|
end
|
||||||
|
|
||||||
|
def issued_to_label
|
||||||
|
t 'contracts.for_office_use_only.description_labels.issued_to'
|
||||||
|
end
|
||||||
|
|
||||||
|
def issued_by_label
|
||||||
|
t 'contracts.for_office_use_only.description_labels.issued_by'
|
||||||
|
end
|
||||||
|
|
||||||
|
def date_issued
|
||||||
|
t 'contracts.for_office_use_only.description_labels.date_issued'
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for an appearance release' do
|
||||||
|
subject { create(:appearance_release_with_contract_template, :native, project: project) }
|
||||||
|
it_behaves_like 'an approvable UI'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for a talent release' do
|
||||||
|
subject { create(:talent_release_with_contract_template, :native, project: project) }
|
||||||
|
it_behaves_like 'an approvable UI'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for a location release' do
|
||||||
|
subject { create(:location_release_with_contract_template, :native, project: project) }
|
||||||
|
it_behaves_like 'an approvable UI'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for a material release' do
|
||||||
|
subject { create(:material_release_with_contract_template, :native, project: project) }
|
||||||
|
it_behaves_like 'an approvable UI'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for a acquired media release' do
|
||||||
|
subject { create(:acquired_media_release_with_contract_template, :native, project: project) }
|
||||||
|
it_behaves_like 'an approvable UI'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for a medical release' do
|
||||||
|
subject { create(:medical_release_with_contract_template, :native, project: project) }
|
||||||
|
it_behaves_like 'an approvable UI'
|
||||||
|
end
|
||||||
|
|
||||||
|
context 'for a misc release' do
|
||||||
|
subject { create(:misc_release_with_contract_template, :native, project: project) }
|
||||||
|
it_behaves_like 'an approvable UI'
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -444,104 +444,9 @@ feature "User managing acquired_media releases" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is account manager" do
|
context "when the user is account manager" do
|
||||||
let(:current_user) { create(:user, :account_manager) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:acquired_media_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_acquired_media_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:acquired_media_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_acquired_media_releases_path(project)
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
|
|
||||||
create(:acquired_media_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_acquired_media_releases_path(project)
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
|
|
||||||
|
|
||||||
create(:acquired_media_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
|
|
||||||
visit project_acquired_media_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
||||||
acquired_media_release = create(:acquired_media_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe',
|
|
||||||
approved_by_user_name: "Big Joe",
|
|
||||||
approved_by_user_email: "some@email.com",
|
|
||||||
approved_at: DateTime.now)
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_acquired_media_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(acquired_media_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).to have_content producer_label
|
|
||||||
expect(pdf_body).to have_content production_label
|
|
||||||
expect(pdf_body).to have_content issued_to_label
|
|
||||||
expect(pdf_body).to have_content issued_by_label
|
|
||||||
expect(pdf_body).to have_content date_issued
|
|
||||||
expect(pdf_body).to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
||||||
acquired_media_release = create(:acquired_media_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe')
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_acquired_media_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(acquired_media_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).not_to have_content producer_label
|
|
||||||
expect(pdf_body).not_to have_content production_label
|
|
||||||
expect(pdf_body).not_to have_content issued_to_label
|
|
||||||
expect(pdf_body).not_to have_content issued_by_label
|
|
||||||
expect(pdf_body).not_to have_content date_issued
|
|
||||||
expect(pdf_body).not_to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is project manager" do
|
context "when the user is project manager" do
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:acquired_media_release_with_contract_template, project: project)
|
|
||||||
|
|
||||||
visit project_acquired_media_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is associate" do
|
context "when the user is associate" do
|
||||||
@@ -703,42 +608,6 @@ feature "User managing acquired_media releases" do
|
|||||||
'Some signature legal language'
|
'Some signature legal language'
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'acquired_media_releases.acquired_media_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Acquired Media Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_office_use_only
|
|
||||||
t 'contracts.for_office_use_only.heading'
|
|
||||||
end
|
|
||||||
|
|
||||||
def producer_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.producer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def production_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_to_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_by_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_issued
|
|
||||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
||||||
end
|
|
||||||
|
|
||||||
def person_is_minor_checkbox
|
def person_is_minor_checkbox
|
||||||
'acquired_media_release_minor'
|
'acquired_media_release_minor'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -687,103 +687,9 @@ feature 'User managing appearance releases' do
|
|||||||
|
|
||||||
context "when the user is account manager" do
|
context "when the user is account manager" do
|
||||||
let(:current_user) { create(:user, :account_manager) }
|
let(:current_user) { create(:user, :account_manager) }
|
||||||
|
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:appearance_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:appearance_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
|
|
||||||
create(:appearance_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
|
|
||||||
|
|
||||||
create(:appearance_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
||||||
appearance_release = create(:appearance_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe',
|
|
||||||
approved_by_user_name: "Big Joe",
|
|
||||||
approved_by_user_email: "some@email.com",
|
|
||||||
approved_at: DateTime.now)
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(appearance_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).to have_content producer_label
|
|
||||||
expect(pdf_body).to have_content production_label
|
|
||||||
expect(pdf_body).to have_content issued_to_label
|
|
||||||
expect(pdf_body).to have_content issued_by_label
|
|
||||||
expect(pdf_body).to have_content date_issued
|
|
||||||
expect(pdf_body).to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
||||||
appearance_release = create(:appearance_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe')
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(appearance_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).not_to have_content producer_label
|
|
||||||
expect(pdf_body).not_to have_content production_label
|
|
||||||
expect(pdf_body).not_to have_content issued_to_label
|
|
||||||
expect(pdf_body).not_to have_content issued_by_label
|
|
||||||
expect(pdf_body).not_to have_content date_issued
|
|
||||||
expect(pdf_body).not_to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is project manager" do
|
context "when the user is project manager" do
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:appearance_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
click_on manage_button
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context 'when the user is associate' do
|
context 'when the user is associate' do
|
||||||
@@ -801,15 +707,6 @@ feature 'User managing appearance releases' do
|
|||||||
click_on manage_button
|
click_on manage_button
|
||||||
expect(page).not_to have_link('Download', exact: true)
|
expect(page).not_to have_link('Download', exact: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:appearance_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_appearance_releases_path(project)
|
|
||||||
click_on manage_button
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -1039,42 +936,6 @@ feature 'User managing appearance releases' do
|
|||||||
'Some signature legal language'
|
'Some signature legal language'
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'appearance_releases.appearance_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Appearance Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_office_use_only
|
|
||||||
t 'contracts.for_office_use_only.heading'
|
|
||||||
end
|
|
||||||
|
|
||||||
def producer_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.producer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def production_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_to_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_by_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_issued
|
|
||||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
||||||
end
|
|
||||||
|
|
||||||
def amendments_heading
|
def amendments_heading
|
||||||
t 'public.amendments.new.amendment.heading'
|
t 'public.amendments.new.amendment.heading'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -383,104 +383,9 @@ feature "User managing location releases" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is account manager" do
|
context "when the user is account manager" do
|
||||||
let(:current_user) { create(:user, :account_manager) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:location_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:location_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
|
|
||||||
create(:location_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
|
|
||||||
|
|
||||||
create(:location_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
||||||
location_release = create(:location_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe',
|
|
||||||
approved_by_user_name: "Big Joe",
|
|
||||||
approved_by_user_email: "some@email.com",
|
|
||||||
approved_at: DateTime.now)
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(location_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).to have_content producer_label
|
|
||||||
expect(pdf_body).to have_content production_label
|
|
||||||
expect(pdf_body).to have_content issued_to_label
|
|
||||||
expect(pdf_body).to have_content issued_by_label
|
|
||||||
expect(pdf_body).to have_content date_issued
|
|
||||||
expect(pdf_body).to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
||||||
location_release = create(:location_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe')
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(location_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).not_to have_content producer_label
|
|
||||||
expect(pdf_body).not_to have_content production_label
|
|
||||||
expect(pdf_body).not_to have_content issued_to_label
|
|
||||||
expect(pdf_body).not_to have_content issued_by_label
|
|
||||||
expect(pdf_body).not_to have_content date_issued
|
|
||||||
expect(pdf_body).not_to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is project manager" do
|
context "when the user is project manager" do
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:location_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
click_on manage_button
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is associate" do
|
context "when the user is associate" do
|
||||||
@@ -498,15 +403,6 @@ feature "User managing location releases" do
|
|||||||
click_on manage_button
|
click_on manage_button
|
||||||
expect(page).not_to have_link("Download", exact: true)
|
expect(page).not_to have_link("Download", exact: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:location_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_location_releases_path(project)
|
|
||||||
click_on manage_button
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -650,42 +546,6 @@ feature "User managing location releases" do
|
|||||||
'Some signature legal language'
|
'Some signature legal language'
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'location_releases.location_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Location Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_office_use_only
|
|
||||||
t 'contracts.for_office_use_only.heading'
|
|
||||||
end
|
|
||||||
|
|
||||||
def producer_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.producer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def production_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_to_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_by_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_issued
|
|
||||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
||||||
end
|
|
||||||
|
|
||||||
def amendments_heading
|
def amendments_heading
|
||||||
t 'public.amendments.new.amendment.heading'
|
t 'public.amendments.new.amendment.heading'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -421,104 +421,9 @@ feature "User managing material releases" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is account manager" do
|
context "when the user is account manager" do
|
||||||
let(:current_user) { create(:user, :account_manager) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:material_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:material_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
|
|
||||||
create(:material_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
|
|
||||||
|
|
||||||
create(:material_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
||||||
material_release = create(:material_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe',
|
|
||||||
approved_by_user_name: "Big Joe",
|
|
||||||
approved_by_user_email: "some@email.com",
|
|
||||||
approved_at: DateTime.now)
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(material_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).to have_content producer_label
|
|
||||||
expect(pdf_body).to have_content production_label
|
|
||||||
expect(pdf_body).to have_content issued_to_label
|
|
||||||
expect(pdf_body).to have_content issued_by_label
|
|
||||||
expect(pdf_body).to have_content date_issued
|
|
||||||
expect(pdf_body).to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
||||||
material_release = create(:material_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe')
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(material_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).not_to have_content producer_label
|
|
||||||
expect(pdf_body).not_to have_content production_label
|
|
||||||
expect(pdf_body).not_to have_content issued_to_label
|
|
||||||
expect(pdf_body).not_to have_content issued_by_label
|
|
||||||
expect(pdf_body).not_to have_content date_issued
|
|
||||||
expect(pdf_body).not_to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is project manager" do
|
context "when the user is project manager" do
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:material_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is associate" do
|
context "when the user is associate" do
|
||||||
@@ -536,15 +441,6 @@ feature "User managing material releases" do
|
|||||||
click_on "Manage"
|
click_on "Manage"
|
||||||
expect(page).not_to have_link("Download", exact: true)
|
expect(page).not_to have_link("Download", exact: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:material_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_material_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -693,42 +589,6 @@ feature "User managing material releases" do
|
|||||||
'Some signature legal language'
|
'Some signature legal language'
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'material_releases.material_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Material Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_office_use_only
|
|
||||||
t 'contracts.for_office_use_only.heading'
|
|
||||||
end
|
|
||||||
|
|
||||||
def producer_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.producer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def production_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_to_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_by_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_issued
|
|
||||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
||||||
end
|
|
||||||
|
|
||||||
def person_is_minor_checkbox
|
def person_is_minor_checkbox
|
||||||
'material_release_minor'
|
'material_release_minor'
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -215,15 +215,6 @@ feature "User managing medical releases" do
|
|||||||
expect(page).to have_link("Download", exact: true, count: 2)
|
expect(page).to have_link("Download", exact: true, count: 2)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:medical_release_with_contract_template, :native, project: project)
|
|
||||||
create(:medical_release_with_contract_template, :non_native, project: project)
|
|
||||||
|
|
||||||
visit project_medical_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Downloading PDF of native medical release is possible" do
|
scenario "Downloading PDF of native medical release is possible" do
|
||||||
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
||||||
|
|
||||||
@@ -233,64 +224,6 @@ feature "User managing medical releases" do
|
|||||||
expect(content_type).to eq('application/pdf')
|
expect(content_type).to eq('application/pdf')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:medical_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_medical_releases_path(project)
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
||||||
medical_release = create(:medical_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe',
|
|
||||||
approved_by_user_name: "Big Joe",
|
|
||||||
approved_by_user_email: "some@email.com",
|
|
||||||
approved_at: DateTime.now)
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_medical_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(medical_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).to have_content producer_label
|
|
||||||
expect(pdf_body).to have_content production_label
|
|
||||||
expect(pdf_body).to have_content issued_to_label
|
|
||||||
expect(pdf_body).to have_content issued_by_label
|
|
||||||
expect(pdf_body).to have_content date_issued
|
|
||||||
expect(pdf_body).to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
||||||
medical_release = create(:medical_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe')
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_medical_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(medical_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).not_to have_content producer_label
|
|
||||||
expect(pdf_body).not_to have_content production_label
|
|
||||||
expect(pdf_body).not_to have_content issued_to_label
|
|
||||||
expect(pdf_body).not_to have_content issued_by_label
|
|
||||||
expect(pdf_body).not_to have_content date_issued
|
|
||||||
expect(pdf_body).not_to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'viewing contract PDF with medical questionnaire' do
|
scenario 'viewing contract PDF with medical questionnaire' do
|
||||||
contract_template = create(:medical_release_contract_template, project: project, questionnaire_legal_text: "Questionnaire legal text", question_1_text: "Question 1 text")
|
contract_template = create(:medical_release_contract_template, project: project, questionnaire_legal_text: "Questionnaire legal text", question_1_text: "Question 1 text")
|
||||||
medical_release = create(:medical_release,
|
medical_release = create(:medical_release,
|
||||||
@@ -343,15 +276,6 @@ feature "User managing medical releases" do
|
|||||||
expect(page).to have_link("Download", exact: true, count: 0)
|
expect(page).to have_link("Download", exact: true, count: 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:medical_release_with_contract_template, :native, project: project)
|
|
||||||
create(:medical_release_with_contract_template, :non_native, project: project)
|
|
||||||
|
|
||||||
visit project_medical_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Downloading PDF of native medical release is not possible" do
|
scenario "Downloading PDF of native medical release is not possible" do
|
||||||
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
||||||
|
|
||||||
@@ -396,15 +320,6 @@ feature "User managing medical releases" do
|
|||||||
expect(page).to have_link("Download", exact: true, count: 0)
|
expect(page).to have_link("Download", exact: true, count: 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:medical_release_with_contract_template, :native, project: project)
|
|
||||||
create(:medical_release_with_contract_template, :non_native, project: project)
|
|
||||||
|
|
||||||
visit project_medical_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Downloading PDF of native medical release is not possible" do
|
scenario "Downloading PDF of native medical release is not possible" do
|
||||||
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
native_release = create(:medical_release_with_contract_template, :native, project: project)
|
||||||
|
|
||||||
@@ -584,40 +499,4 @@ feature "User managing medical releases" do
|
|||||||
def dummy_signature_legal_text
|
def dummy_signature_legal_text
|
||||||
'Some signature legal language'
|
'Some signature legal language'
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'medical_releases.medical_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Medical Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_office_use_only
|
|
||||||
t 'contracts.for_office_use_only.heading'
|
|
||||||
end
|
|
||||||
|
|
||||||
def producer_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.producer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def production_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_to_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_by_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_issued
|
|
||||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -79,83 +79,6 @@ feature "User managing misc releases" do
|
|||||||
expect(content_type).to eq('application/pdf')
|
expect(content_type).to eq('application/pdf')
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:misc_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_misc_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:misc_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_misc_releases_path(project)
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
|
|
||||||
create(:misc_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_misc_releases_path(project)
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
|
|
||||||
|
|
||||||
create(:misc_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
|
|
||||||
visit project_misc_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
||||||
misc_release = create(:misc_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe',
|
|
||||||
approved_by_user_name: "Big Joe",
|
|
||||||
approved_by_user_email: "some@email.com",
|
|
||||||
approved_at: DateTime.now)
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_misc_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(misc_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).to have_content producer_label
|
|
||||||
expect(pdf_body).to have_content production_label
|
|
||||||
expect(pdf_body).to have_content issued_to_label
|
|
||||||
expect(pdf_body).to have_content issued_by_label
|
|
||||||
expect(pdf_body).to have_content date_issued
|
|
||||||
expect(pdf_body).to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
||||||
misc_release = create(:misc_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe')
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_misc_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(misc_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).not_to have_content producer_label
|
|
||||||
expect(pdf_body).not_to have_content production_label
|
|
||||||
expect(pdf_body).not_to have_content issued_to_label
|
|
||||||
expect(pdf_body).not_to have_content issued_by_label
|
|
||||||
expect(pdf_body).not_to have_content date_issued
|
|
||||||
expect(pdf_body).not_to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'viewing the contract PDF' do
|
scenario 'viewing the contract PDF' do
|
||||||
misc_release = create(:misc_release,
|
misc_release = create(:misc_release,
|
||||||
@@ -218,14 +141,6 @@ feature "User managing misc releases" do
|
|||||||
|
|
||||||
expect(page).to have_link("Download", exact: true, count: 0)
|
expect(page).to have_link("Download", exact: true, count: 0)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:misc_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_misc_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -300,40 +215,4 @@ feature "User managing misc releases" do
|
|||||||
def view_release_pdf_link_for(release)
|
def view_release_pdf_link_for(release)
|
||||||
['Download', href: misc_release_contracts_path(release, format: 'pdf')]
|
['Download', href: misc_release_contracts_path(release, format: 'pdf')]
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'misc_releases.misc_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Misc Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_office_use_only
|
|
||||||
t 'contracts.for_office_use_only.heading'
|
|
||||||
end
|
|
||||||
|
|
||||||
def producer_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.producer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def production_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_to_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_by_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_issued
|
|
||||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -92,39 +92,9 @@ feature "User managing music releases" do
|
|||||||
before do
|
before do
|
||||||
sign_in current_user
|
sign_in current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:music_release_with_contract_template, project: project)
|
|
||||||
|
|
||||||
visit project_music_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:music_release_with_contract_template, project: project)
|
|
||||||
|
|
||||||
visit project_music_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is project manager" do
|
context "when the user is project manager" do
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:music_release_with_contract_template, project: project)
|
|
||||||
|
|
||||||
sign_in current_user
|
|
||||||
visit project_music_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is associate" do
|
context "when the user is associate" do
|
||||||
@@ -133,24 +103,15 @@ feature "User managing music releases" do
|
|||||||
before do
|
before do
|
||||||
sign_in current_user
|
sign_in current_user
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "should not show download" do
|
scenario "should not show download" do
|
||||||
collection1 = create(:music_release, name: "EDM Music", project: project)
|
collection1 = create(:music_release, name: "EDM Music", project: project)
|
||||||
|
|
||||||
visit project_music_releases_path(project)
|
visit project_music_releases_path(project)
|
||||||
|
|
||||||
click_on "Manage"
|
click_on "Manage"
|
||||||
expect(page).not_to have_link("Download", exact: true)
|
expect(page).not_to have_link("Download", exact: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:music_release_with_contract_template, project: project)
|
|
||||||
|
|
||||||
visit project_music_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -216,16 +177,4 @@ feature "User managing music releases" do
|
|||||||
select "Other", from: "Restriction"
|
select "Other", from: "Restriction"
|
||||||
fill_in "Describe other restrictions", with: "Test"
|
fill_in "Describe other restrictions", with: "Test"
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'music_releases.music_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Music Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -374,104 +374,9 @@ feature "User managing talent releases" do
|
|||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is account manager" do
|
context "when the user is account manager" do
|
||||||
let(:current_user) { create(:user, :account_manager) }
|
|
||||||
|
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is visible" do
|
|
||||||
create(:talent_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Reviewing release" do
|
|
||||||
create(:talent_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
|
|
||||||
click_link review_action
|
|
||||||
|
|
||||||
expect(page).to have_content review_page_heading
|
|
||||||
expect(page).to have_content approve_button
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Approved releases have checkmark and non-approved releases don't have checkmarks" do
|
|
||||||
create(:talent_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 0)
|
|
||||||
|
|
||||||
create(:talent_release_with_contract_template, :native, project: project, approved_by_user_email: "some@email.com", approved_at: DateTime.now)
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
|
|
||||||
expect(page).to have_css('i.fa.fa-check-circle.fa-2x', count: 1)
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of approved release there is page for office use only' do
|
|
||||||
talent_release = create(:talent_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe',
|
|
||||||
approved_by_user_name: "Big Joe",
|
|
||||||
approved_by_user_email: "some@email.com",
|
|
||||||
approved_at: DateTime.now)
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(talent_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).to have_content producer_label
|
|
||||||
expect(pdf_body).to have_content production_label
|
|
||||||
expect(pdf_body).to have_content issued_to_label
|
|
||||||
expect(pdf_body).to have_content issued_by_label
|
|
||||||
expect(pdf_body).to have_content date_issued
|
|
||||||
expect(pdf_body).to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario 'When viewing the contract PDF of not approved release there is no page for office use only' do
|
|
||||||
talent_release = create(:talent_release_with_contract_template,
|
|
||||||
:native,
|
|
||||||
project: project,
|
|
||||||
person_first_name: 'Jane',
|
|
||||||
person_last_name: 'Doe')
|
|
||||||
|
|
||||||
sign_in(current_user)
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
click_link *view_release_pdf_link_for(talent_release)
|
|
||||||
|
|
||||||
expect(content_type).to eq('application/pdf')
|
|
||||||
expect(content_disposition).to include('inline')
|
|
||||||
expect(pdf_body).not_to have_content for_office_use_only.upcase
|
|
||||||
expect(pdf_body).not_to have_content producer_label
|
|
||||||
expect(pdf_body).not_to have_content production_label
|
|
||||||
expect(pdf_body).not_to have_content issued_to_label
|
|
||||||
expect(pdf_body).not_to have_content issued_by_label
|
|
||||||
expect(pdf_body).not_to have_content date_issued
|
|
||||||
expect(pdf_body).not_to have_content 'Big Joe'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is project manager" do
|
context "when the user is project manager" do
|
||||||
before do
|
|
||||||
sign_in current_user
|
|
||||||
end
|
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:talent_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
context "when the user is associate" do
|
context "when the user is associate" do
|
||||||
@@ -489,15 +394,6 @@ feature "User managing talent releases" do
|
|||||||
click_on "Manage"
|
click_on "Manage"
|
||||||
expect(page).not_to have_link("Download", exact: true)
|
expect(page).not_to have_link("Download", exact: true)
|
||||||
end
|
end
|
||||||
|
|
||||||
scenario "Review action in Manage menu is not visible" do
|
|
||||||
create(:talent_release_with_contract_template, :native, project: project)
|
|
||||||
|
|
||||||
visit project_talent_releases_path(project)
|
|
||||||
click_on "Manage"
|
|
||||||
|
|
||||||
expect(page).not_to have_link(review_action, exact: true)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
private
|
private
|
||||||
@@ -679,40 +575,4 @@ feature "User managing talent releases" do
|
|||||||
def dummy_signature_legal_text
|
def dummy_signature_legal_text
|
||||||
'Some signature legal language'
|
'Some signature legal language'
|
||||||
end
|
end
|
||||||
|
|
||||||
def review_action
|
|
||||||
t 'talent_releases.talent_release.actions.review'
|
|
||||||
end
|
|
||||||
|
|
||||||
def review_page_heading
|
|
||||||
t 'approvals.new.heading', release_type: "Talent Release"
|
|
||||||
end
|
|
||||||
|
|
||||||
def approve_button
|
|
||||||
t 'approvals.new.actions.approve'
|
|
||||||
end
|
|
||||||
|
|
||||||
def for_office_use_only
|
|
||||||
t 'contracts.for_office_use_only.heading'
|
|
||||||
end
|
|
||||||
|
|
||||||
def producer_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.producer'
|
|
||||||
end
|
|
||||||
|
|
||||||
def production_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.production'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_to_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_to'
|
|
||||||
end
|
|
||||||
|
|
||||||
def issued_by_label
|
|
||||||
t 'contracts.for_office_use_only.description_labels.issued_by'
|
|
||||||
end
|
|
||||||
|
|
||||||
def date_issued
|
|
||||||
t 'contracts.for_office_use_only.description_labels.date_issued'
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe AcquiredMediaRelease do
|
RSpec.describe AcquiredMediaRelease do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like "a contractable"
|
it_behaves_like "a contractable"
|
||||||
it_behaves_like "an exploitable"
|
it_behaves_like "an exploitable"
|
||||||
it_behaves_like "a notable"
|
it_behaves_like "a notable"
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe AppearanceRelease do
|
RSpec.describe AppearanceRelease do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like 'a contractable'
|
it_behaves_like 'a contractable'
|
||||||
it_behaves_like 'an exploitable'
|
it_behaves_like 'an exploitable'
|
||||||
it_behaves_like 'a notable'
|
it_behaves_like 'a notable'
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe LocationRelease do
|
RSpec.describe LocationRelease do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like "a contractable"
|
it_behaves_like "a contractable"
|
||||||
it_behaves_like "an exploitable"
|
it_behaves_like "an exploitable"
|
||||||
it_behaves_like "a notable"
|
it_behaves_like "a notable"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe MaterialRelease do
|
RSpec.describe MaterialRelease do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like "a contractable"
|
it_behaves_like "a contractable"
|
||||||
it_behaves_like "an exploitable"
|
it_behaves_like "an exploitable"
|
||||||
it_behaves_like "a notable"
|
it_behaves_like "a notable"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe MedicalRelease do
|
RSpec.describe MedicalRelease do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like "a contractable"
|
it_behaves_like "a contractable"
|
||||||
it_behaves_like "a notable"
|
it_behaves_like "a notable"
|
||||||
it_behaves_like "a photoable"
|
it_behaves_like "a photoable"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe MiscRelease, type: :model do
|
RSpec.describe MiscRelease, type: :model do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like "a contractable"
|
it_behaves_like "a contractable"
|
||||||
it_behaves_like "a notable"
|
it_behaves_like "a notable"
|
||||||
it_behaves_like "a photoable"
|
it_behaves_like "a photoable"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe MusicRelease do
|
RSpec.describe MusicRelease do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like "a contractable"
|
it_behaves_like "a contractable"
|
||||||
it_behaves_like "an exploitable"
|
it_behaves_like "an exploitable"
|
||||||
it_behaves_like "a notable"
|
it_behaves_like "a notable"
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
require "rails_helper"
|
require "rails_helper"
|
||||||
|
|
||||||
RSpec.describe TalentRelease do
|
RSpec.describe TalentRelease do
|
||||||
|
it_behaves_like 'an approvable'
|
||||||
it_behaves_like "a contractable"
|
it_behaves_like "a contractable"
|
||||||
it_behaves_like "an exploitable"
|
it_behaves_like "an exploitable"
|
||||||
it_behaves_like "a notable"
|
it_behaves_like "a notable"
|
||||||
|
|||||||
47
spec/support/shared_examples_for_an_approvable.rb
Normal file
47
spec/support/shared_examples_for_an_approvable.rb
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
shared_examples_for "an approvable" do
|
||||||
|
it { is_expected.to respond_to(:approved_by_user_signature) }
|
||||||
|
|
||||||
|
describe "#approve_by" do
|
||||||
|
before do
|
||||||
|
allow(BigMediaTime).to receive(:time_zone_now).and_return(1.week.ago)
|
||||||
|
end
|
||||||
|
|
||||||
|
it "stores info about the approving user" do
|
||||||
|
user = double(full_name: "Jane Doe", email: "jane.doe@test.com")
|
||||||
|
|
||||||
|
subject.approve_by(user)
|
||||||
|
|
||||||
|
expect(subject.approved_by_user_name).to eq "Jane Doe"
|
||||||
|
expect(subject.approved_by_user_email).to eq "jane.doe@test.com"
|
||||||
|
expect(subject.approved_at).to eq BigMediaTime.time_zone_now
|
||||||
|
end
|
||||||
|
|
||||||
|
context "when approval has already been given" do
|
||||||
|
it "does not change the existing info" do
|
||||||
|
user1 = double(full_name: "Jane Doe", email: "jane.doe@test.com")
|
||||||
|
subject.approve_by(user1)
|
||||||
|
|
||||||
|
expect(subject.approved_by_user_name).to eq "Jane Doe"
|
||||||
|
expect(subject.approved_by_user_email).to eq "jane.doe@test.com"
|
||||||
|
expect(subject.approved_at).to eq BigMediaTime.time_zone_now
|
||||||
|
|
||||||
|
user2 = double(full_name: "John Doe", email: "john.doe@test.com")
|
||||||
|
subject.approve_by(user2)
|
||||||
|
|
||||||
|
expect(subject.approved_by_user_name).to eq "Jane Doe"
|
||||||
|
expect(subject.approved_by_user_email).to eq "jane.doe@test.com"
|
||||||
|
expect(subject.approved_at).to eq BigMediaTime.time_zone_now
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
|
describe "#approved?" do
|
||||||
|
it "indicates whether or not it has been approved" do
|
||||||
|
subject.approved_at = nil
|
||||||
|
expect(subject).not_to be_approved
|
||||||
|
|
||||||
|
subject.approved_at = 1.week.ago
|
||||||
|
expect(subject).to be_approved
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
@@ -2,7 +2,7 @@ module SignatureHelper
|
|||||||
def draw_signature(file, signature_field_id)
|
def draw_signature(file, signature_field_id)
|
||||||
data_uri = ActionController::Base.helpers.escape_javascript(Base64Image.from_image(file).data_uri)
|
data_uri = ActionController::Base.helpers.escape_javascript(Base64Image.from_image(file).data_uri)
|
||||||
page.execute_script <<-JS
|
page.execute_script <<-JS
|
||||||
$("##{signature_field_id}").val("#{data_uri}")
|
document.getElementById("#{signature_field_id}").value = "#{data_uri}";
|
||||||
JS
|
JS
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
Reference in New Issue
Block a user