Library providing tools for writing and running RSpec tests.
Matcher for testing whether an object has a specific constant. Includes functionality for testing the value of the constant and whether the constant is immutable.
DEFAULT_EXPECTED_ITEMS
= Object.new
#initialize expected => HaveConstantMatcher
#actual => Object (readonly)
#description => Object
#does_not_match? actual => Boolean
Inverse of #matches? method.
#failure_message => Object
Message for when the object does not match, but was expected to. Make sure to always call #matches? first to set up the matcher state.
#failure_message_when_negated => Object
Message for when the object matches, but was expected not to. Make sure to always call #matches? first to set up the matcher state.
#immutable => HaveConstantMatcher
Also known as:
frozen
Sets a mutability expectation. The matcher will determine whether the
value of the constant is mutable. Values of nil
, false
, true
are
always immutable, as are Numeric
and Symbol
primitives. Array
values must be frozen and all array items must be immutable. Hash
values must be frozen and all hash keys and values must be immutable.
#immutable? => Boolean
Also known as:
frozen?
#matches? actual => Boolean
Checks if the object has a constant :expected. Additionally, if a value expectation is set, compares the value of #expected to the specified value and checks the mutability of the constant.
#with value => HaveConstantMatcher
Also known as:
with_value
Sets a value expectation. The matcher will compare the value of the constant with the specified value.
Back to Documentation | Versions | 2.8.1 | Reference | RSpec | RSpec::SleepingKingStudios | RSpec::SleepingKingStudios::Matchers | RSpec::SleepingKingStudios::Matchers::Core