Class: RSpec::Mocks::AnyInstance::Chain

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

Direct Known Subclasses

ExpectationChain, StubChain

Instance Method Summary collapse

Instance Method Details

#constrained_to_any_of?(*constraints) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
27
28
29
30
# File 'lib/rspec/mocks/any_instance.rb', line 24

def constrained_to_any_of?(*constraints)
  constraints.any? do |constraint|
    messages.any? do |message|
      message.first.first == constraint
    end
  end
end

#playback!(instance) ⇒ Object



18
19
20
21
22
# File 'lib/rspec/mocks/any_instance.rb', line 18

def playback!(instance)
  messages.inject(instance) do |instance, message|
    instance.send(*message.first, &message.last)
  end
end