Sha256: 86290ed5056946cb6a87e1894ee5187f4777c37bc7fb9069b00ec845f83e901b

Contents?: true

Size: 1.04 KB

Versions: 11

Compression:

Stored size: 1.04 KB

Contents

require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
require 'webmock_spec'
require 'ostruct'

require 'httpclient_spec_helper'

describe "Webmock with HTTPClient" do
  include HTTPClientSpecHelper

  before(:each) do
    HTTPClientSpecHelper.async_mode = false
  end

  it_should_behave_like "WebMock"

  it "should yield block on response if block provided" do
    stub_http_request(:get, "www.example.com").to_return(:body => "abc")
    response_body = ""
    http_request(:get, "http://www.example.com/") do |body|
      response_body = body
    end
    response_body.should == "abc"
  end

   it "should match requests if headers are the same  but in different order" do
     stub_http_request(:get, "www.example.com").with(:headers => {"a" => ["b", "c"]} )
     http_request(
       :get, "http://www.example.com/",
       :headers => {"a" => ["c", "b"]}).status.should == "200"
   end
  

  describe "async requests" do

    before(:each) do
      HTTPClientSpecHelper.async_mode = true
    end

    it_should_behave_like "WebMock"

  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
webmock-1.4.0 spec/httpclient_spec.rb
webmock-1.3.5 spec/httpclient_spec.rb
webmock-1.3.4 spec/httpclient_spec.rb
webmock-1.3.3 spec/httpclient_spec.rb
webmock-1.3.2 spec/httpclient_spec.rb
webmock-1.3.1 spec/httpclient_spec.rb
webmock-1.3.0 spec/httpclient_spec.rb
webmock-1.2.2 spec/httpclient_spec.rb
webmock-1.2.1 spec/httpclient_spec.rb
webmock-1.2.0 spec/httpclient_spec.rb
webmock-1.1.0 spec/httpclient_spec.rb