Sha256: 970950e99efe0b5c7965c6c79c3474c853a401ceab157d782729c09dd9448011

Contents?: true

Size: 901 Bytes

Versions: 7

Compression:

Stored size: 901 Bytes

Contents

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

unless RUBY_PLATFORM =~ /java/
  require 'em_http_request_spec_helper'

  describe "Webmock with EM::HttpRequest" do
    include EMHttpRequestSpecHelper

    it_should_behave_like "WebMock"

    it "should work with streaming" do
      stub_http_request(:get, "www.example.com").to_return(:body => "abc")
      response = ""
      EM.run {
        http = EventMachine::HttpRequest.new('http://www.example.com/').get
        http.stream { |chunk| response = chunk; EM.stop  }
      }
      response.should == "abc"
    end

    it "should work with optional query params" do
      stub_http_request(:get, "www.example.com/?x=3&a[]=b&a[]=c").to_return(:body => "abc")
      http_request(:get, "http://www.example.com/?x=3", :query => {"a" => ["b", "c"]}).body.should == "abc"
    end

  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
webmock-1.4.0 spec/em_http_request_spec.rb
webmock-1.3.5 spec/em_http_request_spec.rb
webmock-1.3.4 spec/em_http_request_spec.rb
webmock-1.3.3 spec/em_http_request_spec.rb
webmock-1.3.2 spec/em_http_request_spec.rb
webmock-1.3.1 spec/em_http_request_spec.rb
webmock-1.3.0 spec/em_http_request_spec.rb