Sha256: e63aad8e1af7b86772d8d19b3f8abf451324e7bfdb722c9dbec28e568770fd08

Contents?: true

Size: 935 Bytes

Versions: 19

Compression:

Stored size: 935 Bytes

Contents

require 'saddle'

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 parse JSON encoded responses" do
        @stubs.get('/test.json') {
          [
            200,
            {'Content-Type' => 'application/json'},
            {'success' => true},
          ]
        }
        @default_client.requester.get('/test.json')['success'].should == true
      end

    end
  end
end

Version data entries

19 entries across 19 versions & 1 rubygems

Version Path
saddle-0.0.31 spec/requester/get_spec.rb
saddle-0.0.30 spec/requester/get_spec.rb
saddle-0.0.27 spec/requester/get_spec.rb
saddle-0.0.26 spec/requester/get_spec.rb
saddle-0.0.25 spec/requester/get_spec.rb
saddle-0.0.23 spec/requester/get_spec.rb
saddle-0.0.22 spec/requester/get_spec.rb
saddle-0.0.21 spec/requester/get_spec.rb
saddle-0.0.19 spec/requester/get_spec.rb
saddle-0.0.18 spec/requester/get_spec.rb
saddle-0.0.17 spec/requester/get_spec.rb
saddle-0.0.16 spec/requester/get_spec.rb
saddle-0.0.15 spec/requester/get_spec.rb
saddle-0.0.14 spec/requester/get_spec.rb
saddle-0.0.12 spec/requester/get_spec.rb
saddle-0.0.11 spec/requester/get_spec.rb
saddle-0.0.10 spec/requester/get_spec.rb
saddle-0.0.7 spec/requester/get_spec.rb
saddle-0.0.6 spec/requester/get_spec.rb