Class: RSpec::SleepingKingStudios::Matchers::Core::HavePropertyMatcher
- Parent Namespace
- RSpec::SleepingKingStudios::Matchers::Core
- Inherited Classes
- RSpec::SleepingKingStudios::Matchers::BaseMatcher
>
Object
- Included Modules
- RSpec::SleepingKingStudios::Matchers::Shared::MatchProperty
- Defined In
- lib/rspec/sleeping_king_studios/matchers/core/have_property_matcher.rb
Table Of Contents
Overview
Matcher for testing whether an object has a specific property, e.g.
responds to #property and #property= and has the specified value for
#property.
Since
Back To Top
Constants
DEFAULT_EXPECTED_ITEMS
= Object.new
- Inherited From
- RSpec::SleepingKingStudios::Matchers::Description
Since
Back To Top
Constructor
#initialize expected, allow_private: false => HavePropertyMatcher
Parameters
- expected (String, Symbol) — The property to check for on the actual
object.
- allow_private (Boolean) — If true, then the matcher will match a
protected or private reader method. Defaults to false.
Returns
- (HavePropertyMatcher) — a new instance of HavePropertyMatcher
Since
Back To Top
Instance Attributes
#actual => Object (readonly)
- Inherited From
- RSpec::SleepingKingStudios::Matchers::BaseMatcher
Since
Back To Top
Instance Methods
#allow_private? => Boolean
Returns
- (Boolean) — True if the matcher matches private reader methods,
otherwise false.
Since
#description => Object
Since
#does_not_match? actual => Boolean
Inverse of #matches? method.
Parameters
- actual (Object) — the object to test against the matcher
Returns
- (Boolean) — false if the object matches, otherwise true
See Also
Since
#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.
Since
#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.
Since
#matches? actual => Boolean
Checks if the object responds to #expected and #expected=. Additionally,
if a value expectation is set, compares the result of calling :expected
to the value.
Parameters
- actual (Object) — The object to check.
Returns
- (Boolean) — true If the object responds to #expected and
#expected= and matches the value expectation (if any); otherwise false.
Since
#with value => HavePropertyMatcher
Also known as:
with_value
Sets a value expectation. The matcher will compare the value to the
result of calling #property.
Parameters
- value (Object) — The value to set and then compare.
Returns
- (HavePropertyMatcher) — self
Since
Back To Top
Back to
Documentation |
Versions |
2.8 |
Reference
|
RSpec
|
RSpec::SleepingKingStudios
|
RSpec::SleepingKingStudios::Matchers
|
RSpec::SleepingKingStudios::Matchers::Core