class RSpec::Rails::Matchers::BaseMatcher
Base class to build matchers. Should not be instantiated directly.
@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 = RSpec::Matchers::EnglishPhrasing.list(expected_ivars) raise "#{self.class.name} needs to supply#{ivar_list}" end
def description
-
(String)
-
Other tags:
- Api: - private
def description desc = RSpec::Matchers::EnglishPhrasing.split_words(self.class.matcher_name) desc << RSpec::Matchers::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 supports_block_expectations?
- Api: - private
def supports_block_expectations? false end