Sha256: 8ac0acfcea57c3f1b57fdea8fe0f9ef958186d6a6332b42a68f4e1aca549de6e

Contents?: true

Size: 1.08 KB

Versions: 12

Compression:

Stored size: 1.08 KB

Contents

require 'spec_helper'

module Seahorse
  module Client
    describe Handler do

      let(:context) { RequestContext.new }
      let(:response) { Response.new }

      it 'provides access to the nested handler' do
        handler = Handler.new
        expect(Handler.new(handler).handler).to be(handler)
      end

      it 'responds to #call' do
        expect(Handler.new).to respond_to(:call)
      end

      it 'chains #call to the nested handler' do
        handler = double('handler')
        expect(handler).to receive(:call).with(context) { response }
        Handler.new(handler).call(context)
      end

      it 'returns the response from the nested handler' do
        handler = double('handler')
        expect(handler).to receive(:call).with(context) { response }
        expect(Handler.new(handler).call(context)).to be(response)
      end

      describe '#inspect' do

        it 'overrides class name for anonymous handler' do
          handler = Class.new(Handler).new
          expect(handler.inspect).to eql '#<UnnamedHandler @handler=nil>'
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
aws-sdk-core-2.0.0.rc12 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc11 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc10 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc9 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc8 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc7 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc6 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc5 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc4 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc3 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc2 vendor/seahorse/spec/seahorse/client/handler_spec.rb
aws-sdk-core-2.0.0.rc1 vendor/seahorse/spec/seahorse/client/handler_spec.rb