Sha256: 6489fe2a57c4e217a2abefc3d225f74032fa68d5730433b728fe0a5669863a0d
Contents?: true
Size: 1.27 KB
Versions: 19
Compression:
Stored size: 1.27 KB
Contents
require 'saddle' describe Saddle::Client do context "POST requests" do context "using the default client" do before :each do @stubs = Faraday::Adapter::Test::Stubs.new @default_client = Saddle::Client.create(:stubs => @stubs) end it "should post empty" do @stubs.post('/test') { [ 200, {}, 'Party on!', ] } @default_client.requester.post('/test').should == 'Party on!' end it "should post url encoded" do @stubs.post('/test', 'a=0&b=true&c=Wingdings') { [ 200, {}, 'Party on!', ] } @default_client.requester.post( '/test', {'a' => 0, 'b' => true, 'c' => 'Wingdings'}, {:request_style => :urlencoded} ).should == 'Party on!' end it "should post JSON encoded" do @stubs.post('/test', '{"a":0,"b":true,"c":"Wingdings"}') { [ 200, {}, 'Party on!', ] } @default_client.requester.post( '/test', {'a' => 0, 'b' => true, 'c' => 'Wingdings'}, {:request_style => :json} ).should == 'Party on!' end end end end
Version data entries
19 entries across 19 versions & 1 rubygems