Sha256: 8f770867fb4f10e72d32fdb271e6b929d11ef4afe89b5b8bd97ba9884c1514d3

Contents?: true

Size: 949 Bytes

Versions: 15

Compression:

Stored size: 949 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}.to_json,
          ]
        }
        @default_client.requester.get('/test.json')['success'].should == true
      end

    end
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
saddle-0.0.51 spec/requester/get_spec.rb
saddle-0.0.50 spec/requester/get_spec.rb
saddle-0.0.49 spec/requester/get_spec.rb
saddle-0.0.48 spec/requester/get_spec.rb
saddle-0.0.46 spec/requester/get_spec.rb
saddle-0.0.45 spec/requester/get_spec.rb
saddle-0.0.44 spec/requester/get_spec.rb
saddle-0.0.43 spec/requester/get_spec.rb
saddle-0.0.42 spec/requester/get_spec.rb
saddle-0.0.41 spec/requester/get_spec.rb
saddle-0.0.38 spec/requester/get_spec.rb
saddle-0.0.37 spec/requester/get_spec.rb
saddle-0.0.36 spec/requester/get_spec.rb
saddle-0.0.35 spec/requester/get_spec.rb
saddle-0.0.34 spec/requester/get_spec.rb