Class: RSpec::Mocks::AnyInstance::Chain Private
Relationships & Source Files | |
Namespace Children | |
Modules:
| |
Extension / Inclusion / Inheritance Descendants | |
Subclasses:
RSpec::Mocks::AnyInstance::ExpectChainChain, RSpec::Mocks::AnyInstance::ExpectationChain, RSpec::Mocks::AnyInstance::PositiveExpectationChain, RSpec::Mocks::AnyInstance::StubChain, RSpec::Mocks::AnyInstance::StubChainChain
|
|
Super Chains via Extension / Inclusion / Inheritance | |
Instance Chain:
self,
Customizations
|
|
Inherits: | Object |
Defined in: | rspec-mocks/lib/rspec/mocks/any_instance/chain.rb |
Class Method Summary
- .new(recorder, *args, &block) ⇒ Chain constructor Internal use only
Instance Attribute Summary
- #negated? ⇒ Boolean readonly private Internal use only
Instance Method Summary
- #constrained_to_any_of?(*constraints) ⇒ Boolean Internal use only
- #expectation_fulfilled! Internal use only
- #matches_args?(*args) ⇒ Boolean Internal use only
- #never Internal use only
- #playback!(instance) Internal use only
- #with(*args, &block) Internal use only
- #last_message private Internal use only
- #messages private Internal use only
- #record(rspec_method_name, *args, &block) private Internal use only
Customizations
- Included
#and_call_original | Records the |
#and_raise | Records the |
#and_return | Records the |
#and_throw | Records the |
#and_wrap_original | Records the |
#and_yield | Records the |
#at_least | Records the |
#at_most | Records the |
#exactly | Records the |
#never | Records the #never message for playback against an instance that invokes a method stubbed or mocked using |
#once | Records the |
#thrice | Records the |
#time | Records the |
#times | Records the |
#twice | Records the |
#with | Records the #with message for playback against an instance that invokes a method stubbed or mocked using |
Instance Attribute Details
#negated? ⇒ Boolean
(readonly, private)
# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 91
def negated? .any? { |(, *_), _| == :never } end
Instance Method Details
#constrained_to_any_of?(*constraints) ⇒ Boolean
# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 61
def constrained_to_any_of?(*constraints) constraints.any? do |constraint| .any? do || .first.first == constraint end end end
#expectation_fulfilled!
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 75
def expectation_fulfilled! @expectation_fulfilled = true end
#last_message (private)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 99
def .last.first.first unless .empty? end
#matches_args?(*args) ⇒ Boolean
# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 70
def matches_args?(*args) @argument_list_matcher.args_match?(*args) end
#messages (private)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 95
def @messages ||= [] end
#never
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 79
def never AnyInstance.error_generator.raise_double_negation_error("expect_any_instance_of(MyClass)") if negated? super end
#playback!(instance)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 53
def playback!(instance) = (instance) .inject( ) do |object, | object.__send__(* .first, & .last) end end
#record(rspec_method_name, *args, &block) (private)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 103
def record(rspec_method_name, *args, &block) verify_invocation_order(rspec_method_name, *args, &block) << [args.unshift(rspec_method_name), block] self end
#with(*args, &block)
[ GitHub ]# File 'rspec-mocks/lib/rspec/mocks/any_instance/chain.rb', line 84
def with(*args, &block) @argument_list_matcher = ArgumentListMatcher.new(*args) super end