module RSpec::Matchers::DSL

def alias_matcher(new_name, old_name, options={}, &description_override)

Other tags:
    See: RSpec::Matchers -

Other tags:
    Yield: - optional block that, when given, is used to define the overridden

Options Hash: (**options)
  • :klass (Class) -- the ruby class to use as the decorator. (Not normally used).

Parameters:
  • options (Hash) -- options for the aliased matcher
  • old_name (Symbol) -- the original name for the matcher
  • new_name (Symbol) -- the new name for the matcher
def alias_matcher(new_name, old_name, options={}, &description_override)
  description_override ||= lambda do |old_desc|
    old_desc.gsub(EnglishPhrasing.split_words(old_name), EnglishPhrasing.split_words(new_name))
  end
  klass = options.fetch(:klass) { AliasedMatcher }
  define_method(new_name) do |*args, &block|
    matcher = __send__(old_name, *args, &block)
    matcher.matcher_name = new_name if matcher.respond_to?(:matcher_name=)
    klass.new(matcher, description_override)
  end
  ruby2_keywords new_name if respond_to?(:ruby2_keywords, true)
end