class RSpec::Matchers::BuiltIn::Has

@api private Provides the implementation for `has_<predicate>`. Not intended to be instantiated directly.

Public Instance Methods

description() click to toggle source

@api private @return [String]

# File lib/rspec/matchers/built_in/has.rb, line 40
def description
  [method_description, args_description].compact.join(' ')
end
does_not_match?(actual, &block) click to toggle source

@private

# File lib/rspec/matchers/built_in/has.rb, line 20
def does_not_match?(actual, &block)
  @actual = actual
  @block ||= block
  predicate_accessible? && !predicate_matches?
end
failure_message() click to toggle source

@api private @return [String]

# File lib/rspec/matchers/built_in/has.rb, line 28
def failure_message
  validity_message || "expected ##{predicate}#{failure_message_args_description} to return true, got false"
end
failure_message_when_negated() click to toggle source

@api private @return [String]

# File lib/rspec/matchers/built_in/has.rb, line 34
def failure_message_when_negated
  validity_message || "expected ##{predicate}#{failure_message_args_description} to return false, got true"
end
matches?(actual, &block) click to toggle source

@private

# File lib/rspec/matchers/built_in/has.rb, line 13
def matches?(actual, &block)
  @actual = actual
  @block ||= block
  predicate_accessible? && predicate_matches?
end

Public Class Methods

new(method_name, *args, &block) click to toggle source
# File lib/rspec/matchers/built_in/has.rb, line 8
def initialize(method_name, *args, &block)
  @method_name, @args, @block = method_name, args, block
end