Sha256: 37472b379e03fe3335ee006170bcd998b91c116339ee3ee1bf9ac39e9ea82ae2

Contents?: true

Size: 660 Bytes

Versions: 4

Compression:

Stored size: 660 Bytes

Contents

require 'spec_helper'

describe Riiif::HTTPFileResolver do
  subject { Riiif::HTTPFileResolver }
  around do |example|
    old_value = Riiif::HTTPFileResolver.id_to_uri
    Riiif::HTTPFileResolver.id_to_uri = lambda {|id| id}
    example.run
    Riiif::HTTPFileResolver.id_to_uri = old_value
  end

  it "should raise an error when the file isn't found" do
    expect(Kernel).to receive(:open).and_raise(OpenURI::HTTPError.new("failure", StringIO.new))
    begin
      subject.find('1234')
    rescue Riiif::ImageNotFoundError => e
    end
    expect(e).to be_a Riiif::ImageNotFoundError
    expect(e.original_exception).to be_an OpenURI::HTTPError
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
riiif-0.0.10 spec/models/http_file_resolver_spec.rb
riiif-0.0.9 spec/models/http_file_resolver_spec.rb
riiif-0.0.8 spec/models/http_file_resolver_spec.rb
riiif-0.0.7 spec/models/http_file_resolver_spec.rb