Sha256: c96834b23a41360fb9768d47678f24b994a4de3c0e9d8b31f54218c5bd9f91da
Contents?: true
Size: 1.15 KB
Versions: 1
Compression:
Stored size: 1.15 KB
Contents
require 'spec_helper' require 'acceptance/webmock_shared' require 'acceptance/excon/excon_spec_helper' describe "Excon" do include ExconSpecHelper include_context "with WebMock", :no_status_message, :no_url_auth it 'should allow Excon requests to use query hash paramters' do stub_request(:get, "http://example.com/resource/?a=1&b=2").to_return(:body => "abc") Excon.get('http://example.com', :path => "resource/", :query => {:a => 1, :b => 2}).body.should == "abc" end it 'should support Excon :expects options' do stub_request(:get, "http://example.com/").to_return(:body => 'a') lambda { Excon.get('http://example.com', :expects => 204) }.should raise_error(Excon::Errors::OK) end let(:file) { File.new(__FILE__) } let(:file_contents) { File.new(__FILE__).read } it 'handles file uploads correctly' do stub_request(:put, "http://example.com/upload").with(:body => file_contents) yielded_request_body = nil WebMock.after_request do |req, res| yielded_request_body = req.body end Excon.put("http://example.com", :path => "upload", :body => file) yielded_request_body.should eq(file_contents) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
webmock-1.9.1 | spec/acceptance/excon/excon_spec.rb |