Upstream sync
This commit is contained in:
@@ -130,7 +130,8 @@ RSpec.describe Account do
|
||||
User,
|
||||
Broadcast,
|
||||
Account,
|
||||
ZoomMeeting
|
||||
ZoomMeeting,
|
||||
MedicalRelease
|
||||
]
|
||||
Rails.application.eager_load!
|
||||
ActiveRecord::Base.descendants.each do |model|
|
||||
|
||||
@@ -13,6 +13,7 @@ describe ContractTemplate do
|
||||
it { is_expected.to have_many(:appearance_releases).dependent(:restrict_with_error) }
|
||||
it { is_expected.to have_many(:location_releases).dependent(:restrict_with_error) }
|
||||
it { is_expected.to have_many(:material_releases).dependent(:restrict_with_error) }
|
||||
it { is_expected.to have_many(:medical_releases).dependent(:restrict_with_error) }
|
||||
end
|
||||
|
||||
describe 'validations' do
|
||||
|
||||
53
spec/models/medical_release_spec.rb
Normal file
53
spec/models/medical_release_spec.rb
Normal file
@@ -0,0 +1,53 @@
|
||||
require "rails_helper"
|
||||
|
||||
RSpec.describe MedicalRelease do
|
||||
it_behaves_like "a contractable"
|
||||
it_behaves_like "a notable"
|
||||
it_behaves_like "a photoable"
|
||||
it_behaves_like "a releasable"
|
||||
|
||||
describe "validations" do
|
||||
it { is_expected.to validate_presence_of(:person_first_name) }
|
||||
it { is_expected.to validate_presence_of(:person_last_name) }
|
||||
|
||||
context "for #person_email" do
|
||||
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) }
|
||||
end
|
||||
|
||||
context "for native releases" do
|
||||
it { is_expected.to validate_attachment_of(:signature).on(:native) }
|
||||
end
|
||||
|
||||
context "for non-native releases" do
|
||||
it { is_expected.to validate_attachment_of(:contract).on(:non_native) }
|
||||
end
|
||||
end
|
||||
|
||||
describe "attachments" do
|
||||
it { is_expected.to respond_to(:signature) }
|
||||
end
|
||||
|
||||
describe "#uses_edl?" do
|
||||
it { is_expected.not_to be_uses_edl }
|
||||
end
|
||||
|
||||
describe "#contract_file_name" do
|
||||
it "includes project name, signed at date, release type, release number and person name" do
|
||||
release = create(:medical_release_with_contract_template, id: 100, signed_at: Date.new(2020, 2, 10), person_first_name: "John", person_last_name: "Doe")
|
||||
|
||||
expect(release.contract_file_name).to eq("my-video-project_medical_2020.02.10_1_doe-john")
|
||||
end
|
||||
|
||||
context "when signed at is nil" do
|
||||
it "uses the created at date" do
|
||||
release = create(:medical_release_with_contract_template,
|
||||
signed_at: nil,
|
||||
created_at: DateTime.new(2020, 2, 10, 12, 0, 0),
|
||||
person_first_name: "John", person_last_name: "Doe")
|
||||
|
||||
expect(release.contract_file_name).to eq("my-video-project_medical_2020.02.10_1_doe-john")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
@@ -1,5 +1,4 @@
|
||||
require "rails_helper"
|
||||
require "zoom_gateway"
|
||||
|
||||
RSpec.describe Project, type: :model do
|
||||
describe "associations" do
|
||||
@@ -10,6 +9,7 @@ RSpec.describe Project, type: :model do
|
||||
it { is_expected.to have_many(:material_releases).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:music_releases).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:talent_releases).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:medical_releases).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:videos).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:contract_templates).dependent(:destroy) }
|
||||
it { is_expected.to have_many(:project_memberships).dependent(:destroy) }
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
require 'rails_helper'
|
||||
require 'zoom_gateway'
|
||||
|
||||
RSpec.describe ZoomMeeting, type: :model do
|
||||
let(:zoom_meeting) { build(:zoom_meeting, api_meeting_id: nil) }
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
require 'zoom_gateway'
|
||||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ZoomUser, type: :model do
|
||||
|
||||
Reference in New Issue
Block a user