Use correct terminology for RSpec matchers #220
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There are four kinds of matchers which are referred to within the RSpec source code:
eq
for RSpec::Matchers::BuiltIn::Eq,include
for RSpec::Matchers::BuiltIn::Include, etc.).RSpec::Matchers.define
. They are not instances of RSpec::Matchers::BuiltIn::Base, but rather RSpec::Matchers::DSL::Matcher.include
has four aliases:a_collection_including
,a_string_including
,a_hash_including
, andincluding
. The objects that such methods return are actually an instance of RSpec::Matchers::AliasedMatcher and wrap the original matcher object.description
, so they effectively match both built-in and custom matchers. More formally, they are objects which pass the check thatRSpec::Matchers.is_a_describable_matcher?
makes: that is, they are either instances of RSpec::Matchers::BuiltIn::Base, or they respond tomatches?
anddescription
and eitherfailure_message
orfailure_message_when_negated
.So far in the SuperDiff code we have been using the phrase "fuzzy object" to describe an aliased matcher. That was derived from
rspec-support
's FuzzyMatcher class, which compares two objects with the consideration that either could be an RSpec matcher object. But that's not an official term, and so it could be confusing if we use that.This commit corrects this term to simply "RSpec matcher object", except in the case where it was being used to test whether a value was an aliased matcher, in which case that term is now used.