Parent

RSpec::Mocks::AnyInstance::Chain

Private Class Methods

record(method_name) click to toggle source

@macro [attach] record

  @method $1(*args, &block)
  Records the `$1` message for playback against an instance that
  invokes a method stubbed or mocked using `any_instance`.

  @see RSpec::Mocks::MessageExpectation#$1
    # File lib/rspec/mocks/any_instance/chain.rb, line 15
15:           def record(method_name)
16:             class_eval(              def #{method_name}(*args, &block)                record(:#{method_name}, *args, &block)              end, __FILE__, __LINE__)
17:           end

Public Instance Methods

constrained_to_any_of?(*constraints) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/chain.rb, line 46
46:         def constrained_to_any_of?(*constraints)
47:           constraints.any? do |constraint|
48:             messages.any? do |message|
49:               message.first.first == constraint
50:             end
51:           end
52:         end
expectation_fulfilled!() click to toggle source

@private

    # File lib/rspec/mocks/any_instance/chain.rb, line 55
55:         def expectation_fulfilled!
56:           @expectation_fulfilled = true
57:         end
playback!(instance) click to toggle source

@private

    # File lib/rspec/mocks/any_instance/chain.rb, line 39
39:         def playback!(instance)
40:           messages.inject(instance) do |_instance, message|
41:             _instance.__send__(*message.first, &message.last)
42:           end
43:         end

Private Instance Methods

last_message() click to toggle source
    # File lib/rspec/mocks/any_instance/chain.rb, line 65
65:         def last_message
66:           messages.last.first.first unless messages.empty?
67:         end
messages() click to toggle source
    # File lib/rspec/mocks/any_instance/chain.rb, line 61
61:         def messages
62:           @messages ||= []
63:         end
record(rspec_method_name, *args, &block) click to toggle source
    # File lib/rspec/mocks/any_instance/chain.rb, line 69
69:         def record(rspec_method_name, *args, &block)
70:           verify_invocation_order(rspec_method_name, *args, &block)
71:           messages << [args.unshift(rspec_method_name), block]
72:           self
73:         end

Disabled; run with --debug to generate this.

[Validate]

Generated with the Darkfish Rdoc Generator 1.1.6.