Class: RSpecJSONAPISerializer::Matchers::HaveLinkMatcher
- Inherits:
-
Base
- Object
- Base
- RSpecJSONAPISerializer::Matchers::HaveLinkMatcher
show all
- Defined in:
- lib/rspec_jsonapi_serializer/matchers/have_link_matcher.rb
Instance Method Summary
collapse
Methods inherited from Base
#initialize
Instance Method Details
#as(value) ⇒ Object
15
16
17
18
19
|
# File 'lib/rspec_jsonapi_serializer/matchers/have_link_matcher.rb', line 15
def as(value)
add_submatcher HaveLinkMatchers::AsMatcher.new(expected, value)
self
end
|
#as_nil ⇒ Object
21
22
23
|
# File 'lib/rspec_jsonapi_serializer/matchers/have_link_matcher.rb', line 21
def as_nil
as(nil)
end
|
#description ⇒ Object
25
26
27
28
29
|
# File 'lib/rspec_jsonapi_serializer/matchers/have_link_matcher.rb', line 25
def description
description = "have link #{expected}"
[description, submatchers.map(&:description)].flatten.join(' ')
end
|
#failure_message ⇒ Object
31
32
33
|
# File 'lib/rspec_jsonapi_serializer/matchers/have_link_matcher.rb', line 31
def failure_message
"Expected #{expectation}."
end
|
#failure_message_when_negated ⇒ Object
35
36
37
|
# File 'lib/rspec_jsonapi_serializer/matchers/have_link_matcher.rb', line 35
def failure_message_when_negated
"Did not expect #{expectation}."
end
|
#matches?(serializer_instance) ⇒ Boolean
9
10
11
12
13
|
# File 'lib/rspec_jsonapi_serializer/matchers/have_link_matcher.rb', line 9
def matches?(serializer_instance)
@serializer_instance = serializer_instance
has_link? && submatchers_match?
end
|