Files
old-holivud2/spec/models/files_for_request_spec.rb
2020-05-31 22:38:19 +02:00

55 lines
1.3 KiB
Ruby

require "rails_helper"
RSpec.describe FilesForRequest do
let(:video) do
create(:video, analysis_uid: "analysis_uid") do |video|
video.file.key = "awesome"
video.edl_file.key = "sauce"
end
end
subject { described_class.new(video) }
describe "#start_timecode_offset" do
it "returns nil" do
expect(subject.start_timecode_offset).to be_nil
end
end
describe "#file_object_name" do
it "returns file key" do
expect(subject.file_object_name).to eq "awesome"
end
it "returns nil when no video file attached" do
video.file.purge
expect(subject.file_object_name).to be_nil
end
end
describe "#edl_file_object_name" do
it "returns edl file key" do
expect(subject.edl_file_object_name).to eq "sauce"
end
it "returns nil when no video file attached" do
video.edl_file.purge
expect(subject.edl_file_object_name).to be_nil
end
end
describe "#aws_bucket_name" do
it "returns AWS bucket name" do
allow(ENV).to receive(:[])
allow(ENV).to receive(:[]).with("AWS_BUCKET").and_return("bucket")
expect(subject.aws_bucket_name).to eq "bucket"
end
end
describe "#job_id" do
it "returns the analysis uid of the video" do
expect(subject.job_id).to eq "analysis_uid"
end
end
end