Class: ActiveModel::Serializers::Matchers::Root
- Inherits:
-
Object
- Object
- ActiveModel::Serializers::Matchers::Root
- Defined in:
- lib/active_model_serializers/matchers.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
Returns the value of attribute actual.
-
#name ⇒ Object
Returns the value of attribute name.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(name = true) ⇒ Root
constructor
A new instance of Root.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(name = true) ⇒ Root
Returns a new instance of Root.
7 8 9 |
# File 'lib/active_model_serializers/matchers.rb', line 7 def initialize(name = true) @name = name end |
Instance Attribute Details
#actual ⇒ Object
Returns the value of attribute actual.
5 6 7 |
# File 'lib/active_model_serializers/matchers.rb', line 5 def actual @actual end |
#name ⇒ Object
Returns the value of attribute name.
5 6 7 |
# File 'lib/active_model_serializers/matchers.rb', line 5 def name @name end |
Instance Method Details
#description ⇒ Object
17 18 19 |
# File 'lib/active_model_serializers/matchers.rb', line 17 def description "have attribute #{name}" end |
#failure_message_for_should ⇒ Object
21 22 23 |
# File 'lib/active_model_serializers/matchers.rb', line 21 def %Q{expected "#{actual._root}" to be "#{name}", but it wasn't} end |
#failure_message_for_should_not ⇒ Object
25 26 27 |
# File 'lib/active_model_serializers/matchers.rb', line 25 def %Q{expected "#{actual._root}" to be "#{name}", but it was} end |
#matches?(actual) ⇒ Boolean
11 12 13 14 15 |
# File 'lib/active_model_serializers/matchers.rb', line 11 def matches?(actual) @actual = actual serializer._root == name end |