Class: RSpec::Matchers::BuiltIn::RespondTo Private
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::Matchers::BuiltIn::RespondTo
- Defined in:
- lib/rspec/matchers/built_in/respond_to.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Provides the implementation for respond_to
.
Not intended to be instantiated directly.
Constant Summary
Constant Summary
Constants inherited from BaseMatcher
Instance Method Summary (collapse)
-
- (Object) argument
(also: #arguments)
No-op.
- - (String) description private
- - (String) failure_message private
- - (String) failure_message_when_negated private
-
- (RespondTo) initialize(*names)
constructor
private
A new instance of RespondTo.
-
- (Object) with(n)
Specifies the number of expected arguments.
Methods inherited from BaseMatcher
#diffable?, #expects_call_stack_jump?, #match_unless_raises, #supports_block_expectations?
Methods included from Composable
#===, #and, #description_of, #or, should_enumerate?, surface_descriptions_in, unreadable_io?, #values_match?
Constructor Details
- (RespondTo) initialize(*names)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of RespondTo
10 11 12 13 |
# File 'lib/rspec/matchers/built_in/respond_to.rb', line 10 def initialize(*names) @names = names @expected_arity = nil end |
Instance Method Details
- (Object) argument Also known as: arguments
No-op. Intended to be used as syntactic sugar when using with
.
30 31 32 |
# File 'lib/rspec/matchers/built_in/respond_to.rb', line 30 def argument self end |
- (String) description
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
59 60 61 |
# File 'lib/rspec/matchers/built_in/respond_to.rb', line 59 def description "respond to #{pp_names}#{with_arity}" end |
- (String) failure_message
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
47 48 49 |
# File 'lib/rspec/matchers/built_in/respond_to.rb', line 47 def "expected #{actual_formatted} to respond to #{@failing_method_names.map { |name| description_of(name) }.join(', ')}#{with_arity}" end |
- (String) failure_message_when_negated
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
53 54 55 |
# File 'lib/rspec/matchers/built_in/respond_to.rb', line 53 def .sub(/to respond to/, 'not to respond to') end |
- (Object) with(n)
Specifies the number of expected arguments.
20 21 22 23 |
# File 'lib/rspec/matchers/built_in/respond_to.rb', line 20 def with(n) @expected_arity = n self end |