Sha256: 838267a29fba9352b98b8323fe29136f908f2ad284462656d456312a506da1fb

Contents?: true

Size: 733 Bytes

Versions: 3

Compression:

Stored size: 733 Bytes

Contents

require 'helper'

describe Wayback::Error::ClientError do

  before do
    @client = Wayback::Client.new
  end

  Wayback::Error::ClientError.errors.each do |status, exception|
    [nil, "error"].each do |body|
      context "when HTTP status is #{status} and body is #{body.inspect}" do
        before do
          body_message = '<wayback><error><title>Hrm.</title><message>Wayback Machine doesn&apos;t have that page archived.</message></error></wayback>' unless body.nil?
          stub_get("/timemap/link/gleu.ch").to_return(:body => body_message, :status => status)
        end
        it "raises #{exception.name}" do
          expect{@client.list('gleu.ch')}.to raise_error exception
        end
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wayback-0.3.1 spec/wayback/error/client_error_spec.rb
wayback-0.2.1 spec/wayback/error/client_error_spec.rb
wayback-0.2.0 spec/wayback/error/client_error_spec.rb