Class: Sequent::Core::Helpers::MessageMatchers::HasAttrs
- Inherits:
-
Struct
- Object
- Struct
- Sequent::Core::Helpers::MessageMatchers::HasAttrs
- Defined in:
- lib/sequent/core/helpers/message_matchers/has_attrs.rb
Instance Attribute Summary collapse
-
#expected_attrs ⇒ Object
Returns the value of attribute expected_attrs.
-
#message_matcher ⇒ Object
Returns the value of attribute message_matcher.
Instance Method Summary collapse
-
#initialize(message_matcher, expected_attrs) ⇒ HasAttrs
constructor
A new instance of HasAttrs.
- #matches_message?(message) ⇒ Boolean
- #to_s ⇒ Object
Constructor Details
#initialize(message_matcher, expected_attrs) ⇒ HasAttrs
Returns a new instance of HasAttrs.
8 9 10 11 12 13 14 15 |
# File 'lib/sequent/core/helpers/message_matchers/has_attrs.rb', line 8 def initialize(, expected_attrs) super fail ArgumentError, 'Missing required message matcher' if .nil? fail ArgumentError, 'Missing required expected attrs' if expected_attrs.blank? self. = ArgumentCoercer.coerce_argument() end |
Instance Attribute Details
#expected_attrs ⇒ Object
Returns the value of attribute expected_attrs
7 8 9 |
# File 'lib/sequent/core/helpers/message_matchers/has_attrs.rb', line 7 def expected_attrs @expected_attrs end |
#message_matcher ⇒ Object
Returns the value of attribute message_matcher
7 8 9 |
# File 'lib/sequent/core/helpers/message_matchers/has_attrs.rb', line 7 def end |
Instance Method Details
#matches_message?(message) ⇒ Boolean
17 18 19 20 |
# File 'lib/sequent/core/helpers/message_matchers/has_attrs.rb', line 17 def () .() && matches_attrs?(, expected_attrs) end |
#to_s ⇒ Object
22 23 24 25 26 27 28 29 |
# File 'lib/sequent/core/helpers/message_matchers/has_attrs.rb', line 22 def to_s # rubocop:disable Layout/LineEndStringConcatenationIndentation 'has_attrs(' \ "#{MessageMatchers::ArgumentSerializer.serialize_value(message_matcher)}, " \ "#{AttrMatchers::ArgumentSerializer.serialize_value(expected_attrs)}" \ ')' # rubocop:enable Layout/LineEndStringConcatenationIndentation end |