Class: RSpec::SleepingKingStudios::Matchers::Core::BeBooleanMatcher
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::SleepingKingStudios::Matchers::Core::BeBooleanMatcher
- Includes:
- Matchers::Composable
- Defined in:
- lib/rspec/sleeping_king_studios/matchers/core/be_boolean_matcher.rb
Overview
Matcher for testing whether an object is true or false.
Constant Summary
Constants included from Description
Description::DEFAULT_EXPECTED_ITEMS
Instance Attribute Summary
Attributes inherited from BaseMatcher
Instance Method Summary collapse
- #description ⇒ Object
-
#failure_message ⇒ Object
Message for when the object does not match, but was expected to.
-
#failure_message_when_negated ⇒ Object
Message for when the object matches, but was expected not to.
-
#matches?(actual) ⇒ Boolean
Checks if the object is true or false.
Methods inherited from BaseMatcher
Instance Method Details
#description ⇒ Object
14 15 16 |
# File 'lib/rspec/sleeping_king_studios/matchers/core/be_boolean_matcher.rb', line 14 def description 'be true or false' end |
#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.
30 31 32 |
# File 'lib/rspec/sleeping_king_studios/matchers/core/be_boolean_matcher.rb', line 30 def "expected #{@actual.inspect} to be true or false" end |
#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.
35 36 37 |
# File 'lib/rspec/sleeping_king_studios/matchers/core/be_boolean_matcher.rb', line 35 def "expected #{@actual.inspect} not to be true or false" end |
#matches?(actual) ⇒ Boolean
Checks if the object is true or false.
23 24 25 26 27 |
# File 'lib/rspec/sleeping_king_studios/matchers/core/be_boolean_matcher.rb', line 23 def matches? actual super true === actual || false === actual end |