Class: ActiveModel::Serializers::Matchers::Embed
- Inherits:
-
Object
- Object
- ActiveModel::Serializers::Matchers::Embed
- Defined in:
- lib/active_model_serializers/matchers.rb
Instance Attribute Summary collapse
-
#actual ⇒ Object
Returns the value of attribute actual.
-
#expected ⇒ Object
Returns the value of attribute expected.
Instance Method Summary collapse
- #description ⇒ Object
- #failure_message_for_should ⇒ Object
- #failure_message_for_should_not ⇒ Object
-
#initialize(expected) ⇒ Embed
constructor
A new instance of Embed.
- #matches?(actual) ⇒ Boolean
Constructor Details
#initialize(expected) ⇒ Embed
Returns a new instance of Embed.
46 47 48 |
# File 'lib/active_model_serializers/matchers.rb', line 46 def initialize(expected) @expected = expected end |
Instance Attribute Details
#actual ⇒ Object
Returns the value of attribute actual.
44 45 46 |
# File 'lib/active_model_serializers/matchers.rb', line 44 def actual @actual end |
#expected ⇒ Object
Returns the value of attribute expected.
44 45 46 |
# File 'lib/active_model_serializers/matchers.rb', line 44 def expected @expected end |
Instance Method Details
#description ⇒ Object
56 57 58 |
# File 'lib/active_model_serializers/matchers.rb', line 56 def description "embed #{name}" end |
#failure_message_for_should ⇒ Object
60 61 62 |
# File 'lib/active_model_serializers/matchers.rb', line 60 def %Q{expected "#{actual.}" to be "#{name}", but it wasn't} end |
#failure_message_for_should_not ⇒ Object
64 65 66 |
# File 'lib/active_model_serializers/matchers.rb', line 64 def %Q{expected "#{actual.}" to be "#{name}", but it was} end |
#matches?(actual) ⇒ Boolean
50 51 52 53 54 |
# File 'lib/active_model_serializers/matchers.rb', line 50 def matches?(actual) @actual = actual serializer. == expected end |