Sha256: 8dcfe9d25c1b778d9120933055db3eeac9a7a1387d88871052db2d873a3010ae

Contents?: true

Size: 915 Bytes

Versions: 11

Compression:

Stored size: 915 Bytes

Contents

# frozen_string_literal: true

class Sinclair
  module Matchers
    # @api private
    # @author darthjee
    # @abstract
    #
    # Base class for add_method matcher
    class AddMethod < RSpec::Matchers::BuiltIn::BaseMatcher
      # @param method [String,Symbol] the method, to be checked, name
      def initialize(method)
        @method = method.to_sym
      end

      # definition needed for block matchers
      #
      # @return [Boolean]
      def supports_block_expectations?
        true
      end

      # Checkes if another instnce is equal self
      #
      # @return [Boolean]
      def equal?(other)
        return unless other.class == self.class

        other.method == method
      end

      alias == equal?

      protected

      # @method method
      # @private
      #
      # The method, to be checked, name
      #
      # @return [Symbol]
      attr_reader :method
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
sinclair-1.6.6 lib/sinclair/matchers/add_method.rb
sinclair-1.6.5 lib/sinclair/matchers/add_method.rb
sinclair-1.6.4 lib/sinclair/matchers/add_method.rb
sinclair-1.6.3 lib/sinclair/matchers/add_method.rb
sinclair-1.6.2 lib/sinclair/matchers/add_method.rb
sinclair-1.6.1 lib/sinclair/matchers/add_method.rb
sinclair-1.6.0 lib/sinclair/matchers/add_method.rb
sinclair-1.5.2 lib/sinclair/matchers/add_method.rb
sinclair-1.5.1 lib/sinclair/matchers/add_method.rb
sinclair-1.5.0 lib/sinclair/matchers/add_method.rb
sinclair-1.4.2 lib/sinclair/matchers/add_method.rb