Sha256: 627087c480fe050268a355d33f37091aaf919ecc5a249d3043044cb7cfdc64ed
Contents?: true
Size: 958 Bytes
Versions: 7
Compression:
Stored size: 958 Bytes
Contents
require 'spec_helper' describe Riiif::HTTPFileResolver do subject { Riiif::HTTPFileResolver.new } before do Dir.glob("tmp/network_files/*") do |f| File.unlink(f) end subject.id_to_uri = lambda {|id| id} end it "raises 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 context "when basic authentication credentials are set" do let(:credentials) { ['username', 's0s3kr3t'] } before do subject.basic_auth_credentials = credentials end it "should use basic auth credentials" do expect(Kernel).to receive(:open).with("1234", { http_basic_authentication: credentials }) subject.find('1234') end end end
Version data entries
7 entries across 7 versions & 1 rubygems