Sha256: ac6df39bad3a121a67d2d7086f8b3b57c18b01b9b00b720f1cf0dafeb220d5d9

Contents?: true

Size: 686 Bytes

Versions: 8

Compression:

Stored size: 686 Bytes

Contents

require 'spec_helper'

describe Hydra::PCDM::GetMimeTypeForFile do
  context 'with faulty input' do
    let(:error_message) { 'supplied argument should be a path to a file' }
    it 'raises and error' do
      expect(-> { described_class.call(['bad input']) }).to raise_error(ArgumentError, error_message)
    end
  end

  context 'with a standard file type' do
    subject    { described_class.call(path) }
    let(:path) { '/path/file.jpg' }

    it { is_expected.to eql 'image/jpeg' }
  end

  context 'with an unknown file type' do
    subject    { described_class.call(path) }
    let(:path) { '/path/file.jkl' }

    it { is_expected.to eql 'application/octet-stream' }
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
hydra-pcdm-1.4.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-1.3.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-1.2.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-1.1.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-1.0.1 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-1.0.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.11.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.10.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb