Class: RSpec::Mocks::AnyInstance::ExpectationChain

Inherits:
Chain
  • Object
show all
Defined in:
lib/rspec/mocks/any_instance.rb

Instance Method Summary collapse

Methods inherited from Chain

#constrained_to_any_of?, #playback!

Constructor Details

#initialize(*args, &block) ⇒ ExpectationChain

Returns a new instance of ExpectationChain.



76
77
78
79
# File 'lib/rspec/mocks/any_instance.rb', line 76

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

Instance Method Details

#expectation_filfilled?Boolean

Returns:

  • (Boolean)


94
95
96
# File 'lib/rspec/mocks/any_instance.rb', line 94

def expectation_filfilled?
  @expectation_fulfilled || constrained_to_any_of?(:never, :any_number_of_times)
end

#expectation_fulfilled!Object



90
91
92
# File 'lib/rspec/mocks/any_instance.rb', line 90

def expectation_fulfilled!
  @expectation_fulfilled = true
end

#invocation_orderObject



81
82
83
84
85
86
87
88
# File 'lib/rspec/mocks/any_instance.rb', line 81

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