Class: Sinclair::Matchers::AddMethodTo Abstract Private
- Inherits:
-
RSpec::Matchers::BuiltIn::BaseMatcher
- Object
- RSpec::Matchers::BuiltIn::BaseMatcher
- Sinclair::Matchers::AddMethodTo
- Defined in:
- lib/sinclair/matchers/add_method_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.
Base class for add_method_to matcher
Direct Known Subclasses
Instance Method Summary collapse
-
#equal?(other) ⇒ Boolean
(also: #==)
private
Checkes if another instnce is equal self.
-
#initialize(method) ⇒ AddMethodTo
constructor
private
A new instance of AddMethodTo.
-
#matches?(event_proc) ⇒ Boolean
private
Checks if expectation is true or not.
-
#supports_block_expectations? ⇒ Boolean
private
definition needed for block matchers.
Constructor Details
#initialize(method) ⇒ AddMethodTo
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 AddMethodTo.
12 13 14 |
# File 'lib/sinclair/matchers/add_method_to.rb', line 12 def initialize(method) @method = method end |
Instance Method Details
#equal?(other) ⇒ Boolean Also known as: ==
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.
Checkes if another instnce is equal self
35 36 37 38 39 40 |
# File 'lib/sinclair/matchers/add_method_to.rb', line 35 def equal?(other) return unless other.class == self.class other.method == method && other.klass == klass end |
#matches?(event_proc) ⇒ Boolean
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.
Checks if expectation is true or not
19 20 21 22 23 24 25 |
# File 'lib/sinclair/matchers/add_method_to.rb', line 19 def matches?(event_proc) return false unless event_proc.is_a?(Proc) raise_block_syntax_error if block_given? perform_change(event_proc) added? end |
#supports_block_expectations? ⇒ Boolean
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.
definition needed for block matchers
28 29 30 |
# File 'lib/sinclair/matchers/add_method_to.rb', line 28 def supports_block_expectations? true end |