Class: Sinclair::Matchers::Base Abstract Private

Inherits:
RSpec::Matchers::BuiltIn::BaseMatcher
  • Object
show all
Defined in:
lib/sinclair/matchers/base.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.

This class is abstract.

Base class for all matchers

Direct Known Subclasses

AddMethod, AddMethodTo, ChangeMethodOn

Instance Method Summary collapse

Constructor Details

#initialize(method_name) ⇒ Base

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 Base.

Parameters:

  • method_name (String, Symbol)

    the method, to be checked, name



11
12
13
# File 'lib/sinclair/matchers/base.rb', line 11

def initialize(method_name)
  @method_name = method_name.to_sym
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

Returns:

  • (Boolean)


25
26
27
28
29
30
# File 'lib/sinclair/matchers/base.rb', line 25

def equal?(other)
  return unless other.class == self.class

  other.method_name == method_name &&
    other.try(:klass) == try(:klass)
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

Returns:

  • (Boolean)


18
19
20
# File 'lib/sinclair/matchers/base.rb', line 18

def supports_block_expectations?
  true
end