Sha256: 8bfa51204dec5bbb879c76063e586b7cf25d4ee3a992b035e97c434c7a80ea70

Contents?: true

Size: 1.28 KB

Versions: 10

Compression:

Stored size: 1.28 KB

Contents

shared_context "complex cross-concern behaviors" do |*adapter_info|
  it 'allows a response with multiple values for the same header to be recorded and played back exactly as-is' do
    WebMock.allow_net_connect!

    recorded_response = nil
    WebMock.after_request { |_,r| recorded_response = r }
    real_response = http_request(:get, webmock_server_url)

    stub_request(:get, webmock_server_url).to_return(
      :status => recorded_response.status,
      :body => recorded_response.body,
      :headers => recorded_response.headers
    )

    played_back_response = http_request(:get, webmock_server_url)

    played_back_response.headers.keys.should include('Set-Cookie')
    played_back_response.should == real_response
  end

  let(:no_content_url) { 'http://httpstat.us/204' }
  [nil, ''].each do |stub_val|
    it "returns the same value (nil or "") for a request stubbed as #{stub_val.inspect} that a real empty response has" do
      unless http_library == :curb
        WebMock.allow_net_connect!

        real_response = http_request(:get, no_content_url)
        stub_request(:get, no_content_url).to_return(:status => 204, :body => stub_val)
        stubbed_response = http_request(:get, no_content_url)

        stubbed_response.body.should eq(real_response.body)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 3 rubygems

Version Path
solidus_backend-1.0.0.pre3 vendor/bundle/gems/webmock-1.8.11/spec/acceptance/shared/complex_cross_concern_behaviors.rb
solidus_backend-1.0.0.pre2 vendor/bundle/gems/webmock-1.8.11/spec/acceptance/shared/complex_cross_concern_behaviors.rb
solidus_backend-1.0.0.pre vendor/bundle/gems/webmock-1.8.11/spec/acceptance/shared/complex_cross_concern_behaviors.rb
simple-client-0.0.3 vendor/bundle/ruby/1.9.1/gems/webmock-1.8.8/spec/acceptance/shared/complex_cross_concern_behaviors.rb
webmock-1.9.0 spec/acceptance/shared/complex_cross_concern_behaviors.rb
webmock-1.8.11 spec/acceptance/shared/complex_cross_concern_behaviors.rb
webmock-1.8.10 spec/acceptance/shared/complex_cross_concern_behaviors.rb
webmock-1.8.9 spec/acceptance/shared/complex_cross_concern_behaviors.rb
simple-client-0.0.2 vendor/bundle/ruby/1.8/gems/webmock-1.8.8/spec/acceptance/shared/complex_cross_concern_behaviors.rb
webmock-1.8.8 spec/acceptance/shared/complex_cross_concern_behaviors.rb