Class: RSpecJSONAPISerializer::Matchers::HaveTypeMatcher

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

Instance Method Summary collapse

Methods inherited from Base

#failure_message_when_negated, #initialize

Constructor Details

This class inherits a constructor from RSpecJSONAPISerializer::Matchers::Base

Instance Method Details

#failure_messageObject



14
15
16
# File 'lib/rspec_jsonapi_serializer/matchers/have_type_matcher.rb', line 14

def failure_message
  "expected that #{serializer_name} to have type :#{expected}, got :#{actual} instead"
end

#matches?(serializer_instance) ⇒ Boolean

Returns:

  • (Boolean)


8
9
10
11
12
# File 'lib/rspec_jsonapi_serializer/matchers/have_type_matcher.rb', line 8

def matches?(serializer_instance)
  @serializer_instance = serializer_instance

  actual == expected
end