Class: RSpec::SleepingKingStudios::Matchers::BuiltIn::BeAKindOfMatcher
- Inherits:
-
Matchers::BuiltIn::BeAKindOf
- Object
- Matchers::BuiltIn::BeAKindOf
- RSpec::SleepingKingStudios::Matchers::BuiltIn::BeAKindOfMatcher
- Defined in:
- lib/rspec/sleeping_king_studios/matchers/built_in/be_kind_of_matcher.rb
Overview
Extensions to the built-in RSpec #be_kind_of matcher.
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.
-
#match(expected, actual) ⇒ Boolean
Checks if the object matches one of the specified types.
Instance Method Details
#description ⇒ Object
10 11 12 |
# File 'lib/rspec/sleeping_king_studios/matchers/built_in/be_kind_of_matcher.rb', line 10 def description = "be #{type_string}" 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.
29 30 31 |
# File 'lib/rspec/sleeping_king_studios/matchers/built_in/be_kind_of_matcher.rb', line 29 def "expected #{@actual.inspect} to be #{type_string}" 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.
34 35 36 |
# File 'lib/rspec/sleeping_king_studios/matchers/built_in/be_kind_of_matcher.rb', line 34 def "expected #{@actual.inspect} not to be #{type_string}" end |
#match(expected, actual) ⇒ Boolean
Checks if the object matches one of the specified types. Allows an expected value of nil as a shortcut for expecting an instance of NilClass.
24 25 26 |
# File 'lib/rspec/sleeping_king_studios/matchers/built_in/be_kind_of_matcher.rb', line 24 def match expected, actual match_type? expected end |