Class: RSpecJSONAPISerializer::Matchers::AssociationMatchers::IdMethodNameMatcher

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

Instance Method Summary collapse

Methods inherited from Base

#failure_message, #failure_message_when_negated

Constructor Details

#initialize(value, relationship_target) ⇒ IdMethodNameMatcher

Returns a new instance of IdMethodNameMatcher.



9
10
11
12
13
# File 'lib/rspec_jsonapi_serializer/matchers/association_matchers/id_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/id_method_name_matcher.rb', line 21

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

#expectationObject



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

def expectation
  [ "with id 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/id_method_name_matcher.rb', line 15

def matches?(serializer_instance)
  @serializer_instance = serializer_instance

  actual == expected
end