Sha256: 8d828224da3e5c454bb309f8f07dc8fe94b780f09b4ce2f47f16731197e0754b

Contents?: true

Size: 941 Bytes

Versions: 2

Compression:

Stored size: 941 Bytes

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 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

2 entries across 2 versions & 1 rubygems

Version Path
saddle-0.0.33 spec/requester/get_spec.rb
saddle-0.0.32 spec/requester/get_spec.rb