Sha256: 36992825fc1c192e172485a5cc02104c1377bb9642fa778946d8671d992e9510

Contents?: true

Size: 851 Bytes

Versions: 12

Compression:

Stored size: 851 Bytes

Contents

module RSpec
  module Mocks
    module AnyInstance
      class StubChain < Chain
        def initialize(*args, &block)
          record(:stub, *args, &block)
        end

        def invocation_order
          @invocation_order ||= {
            :stub => [nil],
            :with => [:stub],
            :and_return => [:with, :stub],
            :and_raise => [:with, :stub],
            :and_yield => [:with, :stub]
          }
        end

        def expectation_fulfilled?
          true
        end
        
        def expectation_fulfilled!
        end

        private
        def verify_invocation_order(rspec_method_name, *args, &block)
          unless invocation_order[rspec_method_name].include?(last_message)
            raise(NoMethodError, "Undefined method #{rspec_method_name}")
          end
        end
      end
    end
  end
end

Version data entries

12 entries across 12 versions & 3 rubygems

Version Path
horseman-0.0.4 vendor/ruby/1.9.1/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
horseman-0.0.3 vendor/ruby/1.9.1/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
horseman-0.0.2 vendor/ruby/1.9.1/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
nutshell-crm-0.0.6.alpha vendor/bundle/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
nutshell-crm-0.0.5 vendor/bundle/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
nutshell-crm-0.0.4 vendor/bundle/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
nutshell-crm-0.0.3 vendor/bundle/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
nutshell-crm-0.0.2 vendor/bundle/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
nutshell-crm-0.0.1 vendor/bundle/gems/rspec-mocks-2.7.0/lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.8.0.rc1 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.7.0 lib/rspec/mocks/any_instance/stub_chain.rb
rspec-mocks-2.7.0.rc1 lib/rspec/mocks/any_instance/stub_chain.rb