Sha256: a349aa4461ce6f0cb9e77c9d769bae9f250c0f0ce68ed30abf5527f858f497d7

Contents?: true

Size: 927 Bytes

Versions: 2

Compression:

Stored size: 927 Bytes

Contents

require 'saddle'



describe Saddle::Client do

  context "Default response requests" do

      before :each do
        @stubs = Faraday::Adapter::Test::Stubs.new
        @default_client = Saddle::Client.create(:stubs => @stubs)
      end

      it "should return as normal upon success" do
        @stubs.get('/test') {
          [
            200,
            {},
            'Party!',
          ]
        }
        @default_client.requester.get(
          '/test',
          {},
          {:default_response => 'Not a party.'}
        ).should == 'Party!'
      end

      it "should return the default response upon failure" do
        @stubs.get('/test') {
          [
            500,
            {},
            'Failure',
          ]
        }
        @default_client.requester.get(
          '/test',
          {},
          {:default_response => 'Not a party.'}
        ).should == 'Not a party.'
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
saddle-0.0.31 spec/middleware/response/default_response_spec.rb
saddle-0.0.30 spec/middleware/response/default_response_spec.rb