Sha256: 6b7e8786771e1f87564e6e3a3172e58fc454e35fdffec79660fb924e434e0a05
Contents?: true
Size: 1.28 KB
Versions: 1
Compression:
Stored size: 1.28 KB
Contents
require 'spec_helper' describe Saddle::Client do context "GET 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 request properly with params" do @stubs.get('/test?name=mike&party=true') { [ 200, {}, 'Party on!', ] } @default_client.requester.get( '/test', {'name' => 'mike', 'party' => true} ).should == 'Party on!' end it "should request properly with params in the body" do @stubs.send(:new_stub, :get, '/test', "body data") { [ 200, {}, 'Party on!', ] } @default_client.requester.get( '/test', {}, {:body => 'body data'} ).should == 'Party on!' end it "should parse JSON encoded responses" do @stubs.get('/test.json') { [ 200, {'Content-Type' => 'application/json'}, {'success' => true}.to_json, ] } @default_client.requester.get('/test.json')['success'].should == true end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
saddle-0.0.53 | spec/requester/get_spec.rb |