Sha256: c61fab430f596253ac31c58512f91ee1987b98fcc1beeecdc309f020107d4ba9

Contents?: true

Size: 913 Bytes

Versions: 4

Compression:

Stored size: 913 Bytes

Contents

# frozen_string_literal: true

class Sinclair
  module Matchers
    # @api private
    # @author darthjee
    #
    # AddInstanceMethod is able to build an instance of
    # {Sinclair::Matchers::ChangeInstanceMethodOn}
    class ChangeInstanceMethod < Base
      include AddMethod

      # @api public
      #
      # Builds final matcher
      #
      # @return [Sinclair::Matchers::ChangeInstanceMethodOn]
      alias on to

      private

      # @private
      #
      # Error description on wrong usage
      #
      # @return String
      def matcher_error
        'You should specify which instance the method is being changed on' \
          "change_method(:#{method_name}).on(instance)"
      end

      # @private
      #
      # Class of the real matcher
      #
      # @return [Class<Sinclair::Matchers::Base>]
      def add_method_to_class
        ChangeInstanceMethodOn
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sinclair-1.9.0 lib/sinclair/matchers/change_instance_method.rb
sinclair-1.8.0 lib/sinclair/matchers/change_instance_method.rb
sinclair-1.7.0 lib/sinclair/matchers/change_instance_method.rb
sinclair-1.6.7 lib/sinclair/matchers/change_instance_method.rb