Sha256: d10249621c52dfc0c2bc597683c9b46124e179aa01322a8d29471124e4b73c45

Contents?: true

Size: 1.42 KB

Versions: 15

Compression:

Stored size: 1.42 KB

Contents

module RSpec
  module Mocks
    module AnyInstance
      # @api private
      class ExpectationChain < Chain
        def expectation_fulfilled?
          @expectation_fulfilled || constrained_to_any_of?(:never, :any_number_of_times)
        end

        def initialize(*args, &block)
          record(*args, &block)
          @expectation_fulfilled = false
        end

        private
        def verify_invocation_order(rspec_method_name, *args, &block)
        end
      end

      # @api private
      class PositiveExpectationChain < ExpectationChain
        def initialize(*args, &block)
          super(:should_receive, *args, &block)
        end

        private

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

      # @api private
      class NegativeExpectationChain < ExpectationChain
        def initialize(*args, &block)
          super(:should_not_receive, *args, &block)
        end

        private

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

Version data entries

15 entries across 15 versions & 6 rubygems

Version Path
tnargav-1.3.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/lib/rspec/mocks/any_instance/expectation_chain.rb
tnargav-1.2.3 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/lib/rspec/mocks/any_instance/expectation_chain.rb
remq-0.0.4 vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/expectation_chain.rb
remq-0.0.3 vendor/bundle/gems/rspec-mocks-2.12.2/lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-2.12.2 lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-2.12.1 lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-2.12.0 lib/rspec/mocks/any_instance/expectation_chain.rb
fragrant-0.0.5 vendor/bundle/ruby/1.9.1/gems/rspec-mocks-2.11.3/lib/rspec/mocks/any_instance/expectation_chain.rb
gem_repackager-0.1.0 support/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-2.11.3 lib/rspec/mocks/any_instance/expectation_chain.rb
librarian-puppet-0.9.4 vendor/gems/ruby/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-2.11.2 lib/rspec/mocks/any_instance/expectation_chain.rb
librarian-puppet-0.9.3 vendor/gems/ruby/1.8/gems/rspec-mocks-2.11.1/lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-2.11.1 lib/rspec/mocks/any_instance/expectation_chain.rb
rspec-mocks-2.11.0 lib/rspec/mocks/any_instance/expectation_chain.rb