Sha256: b34df23031f297a1c17143bcae35006ac8a549d68d1367d43c51bc0000995114

Contents?: true

Size: 956 Bytes

Versions: 10

Compression:

Stored size: 956 Bytes

Contents

require 'spec_helper'

describe Riiif::FileSystemFileResolver do
  let(:resolver) { described_class.new }

  describe '#find' do
    subject { resolver.find(id) }

    context "when the file isn't found" do
      let(:id) { '1234' }
      it 'raises an error' do
        expect { subject }.to raise_error Riiif::ImageNotFoundError
      end
    end

    context 'when the file is found' do
      let(:id) { 'world' }
      it 'returns the jpeg2000 file' do
        expect(subject.path).to eq resolver.root + '/spec/samples/world.jp2'
      end
    end
  end

  describe '#pattern' do
    subject { resolver.pattern(id) }

    context 'with dashes' do
      let(:id) { 'foo-bar-baz' }
      it 'accepts ids with dashes' do
        expect { subject }.not_to raise_error
      end
    end

    context 'with colins' do
      let(:id) { 'fo:baz' }
      it 'accepts ids with colins' do
        expect { subject }.not_to raise_error
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
riiif-1.4.0 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-1.3.0 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-1.2.0 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-1.1.3 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-1.1.2 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-1.1.1 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-1.1.0 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-1.0.0 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-0.4.1 spec/models/riiif/file_system_file_resolver_spec.rb
riiif-0.4.0 spec/models/riiif/file_system_file_resolver_spec.rb