Class: RSpec::SleepingKingStudios::Matchers::Core::BeAUuidMatcher
- Inherits:
-
BaseMatcher
- Object
- BaseMatcher
- RSpec::SleepingKingStudios::Matchers::Core::BeAUuidMatcher
- Defined in:
- lib/rspec/sleeping_king_studios/matchers/core/be_a_uuid_matcher.rb
Overview
Matcher for testing whether an object is a UUID string.
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.
-
#matches?(actual) ⇒ Boolean
Checks if the object is a UUID string.
Methods inherited from BaseMatcher
#does_not_match?, #failure_message_when_negated
Instance Method Details
#description ⇒ Object
12 13 14 |
# File 'lib/rspec/sleeping_king_studios/matchers/core/be_a_uuid_matcher.rb', line 12 def description 'be a UUID' 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.
17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/rspec/sleeping_king_studios/matchers/core/be_a_uuid_matcher.rb', line 17 def = super() + ', but ' return + 'was not a String' unless string? return + 'was too short' if too_short? return + 'was too long' if too_long? return + 'has invalid characters' if invalid_characters? return + 'the format is invalid' unless valid_format? end |
#matches?(actual) ⇒ Boolean
Checks if the object is a UUID string.
39 40 41 42 43 |
# File 'lib/rspec/sleeping_king_studios/matchers/core/be_a_uuid_matcher.rb', line 39 def matches?(actual) super string? && valid_length? && valid_characters? && valid_format? end |