class RSpec::Matchers::BuiltIn::BaseMatcher
class. If/when this changes, we will announce it and remove this warning.
We strongly recommend that you do not base your custom matchers on this
This class is for internal use, and subject to change without notice.
### Warning:
rspec-expectations and rspec-rails.
Used internally as a base class for matchers that ship with
@api private
def self.matcher_name
- Private: -
def self.matcher_name @matcher_name ||= underscore(name.split('::').last) end
def self.underscore(camel_cased_word)
- Private: -
def self.underscore(camel_cased_word) word = camel_cased_word.to_s.dup word.gsub!(/([A-Z]+)([A-Z][a-z])/, '\1_\2') word.gsub!(/([a-z\d])([A-Z])/, '\1_\2') word.tr!('-', '_') word.downcase! word end
def actual_formatted
- Private: -
def actual_formatted RSpec::Support::ObjectFormatter.format(@actual) end
def assert_ivars(*expected_ivars)
def assert_ivars(*expected_ivars) return unless (expected_ivars - present_ivars).any? ivar_list = EnglishPhrasing.list(expected_ivars) raise "#{self.class.name} needs to supply#{ivar_list}" end
def description
-
(String)
-
Other tags:
- Api: - private
def description desc = EnglishPhrasing.split_words(self.class.matcher_name) desc << EnglishPhrasing.list(@expected) if defined?(@expected) desc end
def diffable?
- Api: - private
def diffable? false end
def expected_formatted
- Private: -
def expected_formatted RSpec::Support::ObjectFormatter.format(@expected) end
def expects_call_stack_jump?
- Api: - private
def expects_call_stack_jump? false end
def initialize(expected=UNDEFINED)
def initialize(expected=UNDEFINED) @expected = expected unless UNDEFINED.equal?(expected) end
def match_unless_raises(*exceptions)
- Api: - private
def match_unless_raises(*exceptions) exceptions.unshift Exception if exceptions.empty? begin yield true rescue *exceptions => @rescued_exception false end end
def matcher_name
- Private: -
def matcher_name if defined?(@matcher_name) @matcher_name else self.class.matcher_name end end
def matches?(actual)
- Api: - private
def matches?(actual) @actual = actual match(expected, actual) end
def present_ivars
def present_ivars instance_variables.map(&:to_sym) end
def supports_block_expectations?
- Api: - private
def supports_block_expectations? false end
def supports_value_expectations?
- Private: -
def supports_value_expectations? true end