Sha256: b41de6ea8b5abc99dcc6a9f0e593d8974db19d5a2848365de8860275f88fc63b

Contents?: true

Size: 664 Bytes

Versions: 2

Compression:

Stored size: 664 Bytes

Contents

require 'spec_helper'

describe Typhoeus::Hydra::Stubbable do
  let(:base_url) { "localhost:3001" }
  let(:request) { Typhoeus::Request.new(base_url) }
  let(:response) { Typhoeus::Response.new }
  let(:hydra) { Typhoeus::Hydra.new }

  before { Typhoeus.stub(base_url).and_return(response) }

  describe "#add" do
    it "checks expectations" do
      hydra.add(request)
    end

    context "when expectation found" do
      it "finishes response" do
        expect(request).to receive(:finish)
        hydra.add(request)
      end

      it "is a mock" do
        hydra.add(request)
        expect(request.response.mock).to be(true)
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
typhoeus-0.7.0.pre1 spec/typhoeus/hydra/stubbable_spec.rb
typhoeus-0.6.9 spec/typhoeus/hydra/stubbable_spec.rb