Class: RSpecJSONAPISerializer::Matchers::AssociationMatchers::ObjectMethodNameMatcher

Inherits:
Base
  • Object
show all
Defined in:
lib/rspec_jsonapi_serializer/matchers/association_matchers/object_method_name_matcher.rb

Instance Method Summary collapse

Methods inherited from Base

#failure_message, #failure_message_when_negated

Constructor Details

#initialize(value, relationship_target) ⇒ ObjectMethodNameMatcher

Returns a new instance of ObjectMethodNameMatcher.



9
10
11
12
13
# File 'lib/rspec_jsonapi_serializer/matchers/association_matchers/object_method_name_matcher.rb', line 9

def initialize(value, relationship_target)
  super(value)

  @relationship_target  = relationship_target
end

Instance Method Details

#descriptionObject



21
22
23
# File 'lib/rspec_jsonapi_serializer/matchers/association_matchers/object_method_name_matcher.rb', line 21

def description
  "with object method name #{expected}"
end

#expectationObject



25
26
27
# File 'lib/rspec_jsonapi_serializer/matchers/association_matchers/object_method_name_matcher.rb', line 25

def expectation
  [ "with object method name #{expected}", actual_message ].compact.join(", ")
end

#matches?(serializer_instance) ⇒ Boolean

Returns:

  • (Boolean)


15
16
17
18
19
# File 'lib/rspec_jsonapi_serializer/matchers/association_matchers/object_method_name_matcher.rb', line 15

def matches?(serializer_instance)
  @serializer_instance = serializer_instance

  actual == expected
end