Class: RSpecApi::Matchers::Attributes::Matcher
- Inherits:
-
Json::Matcher
- Object
- Response::Matcher
- Json::Matcher
- RSpecApi::Matchers::Attributes::Matcher
- Defined in:
- lib/rspec-api/matchers/attributes/matcher.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
Attributes inherited from Response::Matcher
Instance Method Summary collapse
- #description ⇒ Object
-
#initialize(*attributes, &block) ⇒ Matcher
constructor
A new instance of Matcher.
- #matches?(response) ⇒ Boolean
Methods inherited from Response::Matcher
#failure_message_for_should, #failure_message_for_should_not
Constructor Details
#initialize(*attributes, &block) ⇒ Matcher
Returns a new instance of Matcher.
11 12 13 |
# File 'lib/rspec-api/matchers/attributes/matcher.rb', line 11 def initialize(*attributes, &block) @attributes = to_hash attributes end |
Instance Attribute Details
#attributes ⇒ Object
Returns the value of attribute attributes.
9 10 11 |
# File 'lib/rspec-api/matchers/attributes/matcher.rb', line 9 def attributes @attributes end |
Instance Method Details
#description ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/rspec-api/matchers/attributes/matcher.rb', line 19 def description if attributes.any? %Q(have attributes #{attributes}) else %Q(have attributes) end end |
#matches?(response) ⇒ Boolean
15 16 17 |
# File 'lib/rspec-api/matchers/attributes/matcher.rb', line 15 def matches?(response) super && has_attributes?(json, attributes) end |