Sha256: 8698a8bde4a6a925f641968b02f0895c35201f14f3b7da36ca841a90b54e1d1a

Contents?: true

Size: 614 Bytes

Versions: 5

Compression:

Stored size: 614 Bytes

Contents

require 'spec_helper'

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

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

  describe "#run" do
    it "checks expectations" do
      request.run
    end

    context "when expectation found" do
      it "finishes request" do
        request.should_receive(:finish)
        request.run
      end

      it "sets mock on response" do
        request.run
        expect(request.response.mock).to be(true)
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
typhoeus-0.6.8 spec/typhoeus/request/stubbable_spec.rb
typhoeus-0.6.7 spec/typhoeus/request/stubbable_spec.rb
typhoeus-0.6.6 spec/typhoeus/request/stubbable_spec.rb
typhoeus-0.6.5 spec/typhoeus/request/stubbable_spec.rb
typhoeus-0.6.4 spec/typhoeus/request/stubbable_spec.rb