Sha256: 2176722e4a0debbc560f4a2ef5dfe735e89480510f30e893dc9a0e95cd313fd9

Contents?: true

Size: 678 Bytes

Versions: 13

Compression:

Stored size: 678 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
    let(:path) { '/path/file.jpg' }
    subject { described_class.call(path) }
    it { is_expected.to eql 'image/jpeg' }
  end

  context 'with an unknown file type' do
    let(:path) { '/path/file.jkl' }
    subject { described_class.call(path) }
    it { is_expected.to eql 'application/octet-stream' }
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
hydra-pcdm-0.9.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.8.2 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.8.1 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.8.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.8.0.beta1 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.7.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.6.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.5.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.4.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.3.2 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.3.1 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.3.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb
hydra-pcdm-0.2.0 spec/hydra/pcdm/services/file/get_mime_type_spec.rb