Sha256: 6e4eb35e2510077e194877077ca6bd1eb70f0a54bc8f30c6518c42476081b655

Contents?: true

Size: 1.16 KB

Versions: 3

Compression:

Stored size: 1.16 KB

Contents

require 'helper'

describe Wayback do

  after do
    Wayback.reset!
  end

  # N.B. IN SPEC, NOT USING http:// DUE TO PARSING ISSUE WITH DOUBLE BACKSLASH.

  context "when delegating to a client" do
    before do
      stub_get("/timemap/link/gleu.ch").to_return(:body => fixture("list.timemap"), :headers => {:content_type => "application/link-format"})
    end
  
    it "requests the correct resource" do
      Wayback.list('gleu.ch')
      expect(a_get("/timemap/link/gleu.ch")).to have_been_made
    end
  
    it "returns the same results as a client" do
      expect(Wayback.list('gleu.ch')).to eq Wayback::Client.new.list('gleu.ch')
    end
  end

  describe ".respond_to?" do
    it "delegates to Wayback::Client" do
      expect(Wayback.respond_to?(:list)).to be_true
    end
    it "takes an optional argument" do
      expect(Wayback.respond_to?(:client, true)).to be_true
    end
  end

  describe ".client" do
    it "returns a Wayback::Client" do
      expect(Wayback.client).to be_a Wayback::Client
    end
  
    context "when the options don't change" do
      it "caches the client" do
        expect(Wayback.client).to eq Wayback.client
      end
    end
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
wayback-0.3.1 spec/wayback_spec.rb
wayback-0.2.1 spec/wayback_spec.rb
wayback-0.2.0 spec/wayback_spec.rb