Task me sync

This commit is contained in:
Senad Uka
2020-06-03 07:24:01 +02:00
parent e3d4d22a34
commit 88836e937e
76 changed files with 847 additions and 497 deletions

View File

@@ -66,16 +66,14 @@ RSpec.describe Account do
end
describe "#storage_total" do
it "sums videos, release photos, contracts, signatures, recordings" do
it "sums videos, release photos, contracts, signatures" do
video_file = Rack::Test::UploadedFile.new(Rails.root.join("spec", "fixtures", "files", "video_file.mp4"), "video/mp4")
recording_file = Rack::Test::UploadedFile.new(Rails.root.join("spec", "fixtures", "files", "video_file.mp4"), "video/mp4")
photo_file = Rack::Test::UploadedFile.new(Rails.root.join("spec", "fixtures", "files", "person_photo.png"), "image/png")
contract_file = Rack::Test::UploadedFile.new(Rails.root.join("spec", "fixtures", "files", "contract.pdf"), "application/pdf")
signature_file = Rack::Test::UploadedFile.new(Rails.root.join("spec", "fixtures", "files", "signature.png"), "image/png")
edl_file = Rack::Test::UploadedFile.new(Rails.root.join("spec", "fixtures", "files", "sample-edl.edl"), "application/octet-stream")
expect(video_file.size).to eq 1_055_736
expect(recording_file.size).to eq 1_055_736
expect(edl_file.size).to eq 440
expect(photo_file.size).to eq 910
expect(contract_file.size).to eq 12
@@ -91,9 +89,8 @@ RSpec.describe Account do
acquired_media_release = create(:acquired_media_release, project: project, contract: contract_file)
import = create(:import, project: project, file: contract_file)
music_release = create(:music_release, project: project, contract: contract_file)
zoom_meeting = create(:zoom_meeting, project: project, recording: recording_file)
expect(account.storage_total).to eq 2_125_672
expect(account.storage_total).to eq 1_069_936
end
it "sums only for projects tied to account" do
@@ -129,8 +126,8 @@ RSpec.describe Account do
Download,
User,
Broadcast,
Account,
ZoomMeeting
TaskRequest,
Account
]
Rails.application.eager_load!
ActiveRecord::Base.descendants.each do |model|

View File

@@ -6,7 +6,6 @@ describe HeadshotCollection do
project = create(:project,
appearance_releases: create_list(:appearance_release, 1),
talent_releases: create_list(:talent_release, 1),
headshot_collection_uid: "123abc"
)
collection = HeadshotCollection.for_project(project)
@@ -15,7 +14,7 @@ describe HeadshotCollection do
expect(collection).to be_a(HeadshotCollection)
expect(collection.releasables).to include(project.appearance_releases.first)
expect(collection.releasables).to include(project.talent_releases.first)
expect(collection.collection_uid).to eq(project.headshot_collection_uid)
expect(collection.collection_uid).to eq(project.id)
end
context "when a release has no headshot photo attachment" do
@@ -86,17 +85,6 @@ describe HeadshotCollection do
expect(mapping["appearance_release_#{releases.first.id}"]).to include("123")
expect(mapping["talent_release_#{releases.last.id}"]).to include("456")
end
context "when collection uid is blank" do
it "is not included in the hash" do
releases = []
collection = HeadshotCollection.new(nil, releases)
hash = collection.to_hash
expect(hash.keys).not_to include(:collection_uid)
end
end
end
private

View File

@@ -0,0 +1,16 @@
require 'rails_helper'
RSpec.describe TaskRequest, type: :model do
describe "associations" do
it { is_expected.to belong_to(:project) }
end
describe "enums" do
it { is_expected.to define_enum_for(:status).with_values([:pending, :completed, :cancelled]) }
end
describe "#order_by_recent" do
subject { described_class }
it { is_expected.to respond_to(:order_by_recent) }
end
end

View File

@@ -16,17 +16,6 @@ RSpec.describe ZoomMeeting, type: :model do
end
describe "attachments" do
it { is_expected.to respond_to(:recording) }
end
describe "validations" do
context '#recording' do
it { is_expected.to allow_content_type("video/mp4").for(:recording) }
it { is_expected.not_to allow_content_types("image/png").for(:recording) }
end
end
describe 'associations' do
it { is_expected.to belong_to(:zoom_user) }
it { is_expected.to belong_to(:project).optional(true) }