Sha256: 9e3dcb7e03173859df6a0dae084c3b06a72bd771eb799fee049eae7afc5d6d64
Contents?: true
Size: 1.54 KB
Versions: 12
Compression:
Stored size: 1.54 KB
Contents
module Ddr::Models RSpec.describe MediaType do subject { described_class.call(file) } describe "when a preferred media type is available" do describe "with a file path" do let(:file) { 'foo.mp4' } it { is_expected.to eq 'video/mp4' } end describe "with an object that responds to :path" do let(:file) { double(path: 'foo.mp4') } it { is_expected.to eq 'video/mp4' } end end describe "when a preferred media type is not available" do describe "and the file responds to :content_type" do let(:file) { double(path: 'foo.jpg', content_type: 'foo/bar') } it { is_expected.to eq 'foo/bar' } end describe "and the file does not respond to :content_type" do describe "and MIME types are present" do describe "with an object that responds to :path" do let(:file) { double(path: 'foo.jpg') } it { is_expected.to eq 'image/jpeg' } end describe "with a file path" do let(:file) { 'foo.jpg' } it { is_expected.to eq 'image/jpeg' } end end describe "and MIME types are not present" do describe "with an object that responds to :path" do let(:file) { double(path: 'foo.bar') } it { is_expected.to eq 'application/octet-stream' } end describe "with a file path" do let(:file) { 'foo.bar' } it { is_expected.to eq 'application/octet-stream' } end end end end end end
Version data entries
12 entries across 12 versions & 1 rubygems