Class: RSpecApi::Matchers::Response::Matcher

Inherits:
Object
  • Object
show all
Defined in:
lib/rspec-api/matchers/response/matcher.rb

Direct Known Subclasses

Headers::Matcher, Json::Matcher, Status::Matcher

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#responseObject

Returns the value of attribute response.



8
9
10
# File 'lib/rspec-api/matchers/response/matcher.rb', line 8

def response
  @response
end

Instance Method Details

#descriptionObject



16
17
18
# File 'lib/rspec-api/matchers/response/matcher.rb', line 16

def description
  %Q(be a valid response)
end

#failure_message_for_shouldObject



20
21
22
# File 'lib/rspec-api/matchers/response/matcher.rb', line 20

def failure_message_for_should
  "expected #{match} to #{description}, but got #{actual}"
end

#failure_message_for_should_notObject



24
25
26
# File 'lib/rspec-api/matchers/response/matcher.rb', line 24

def failure_message_for_should_not
  "expected #{match} not to #{description}, but got #{actual}"
end

#matches?(response) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


10
11
12
13
# File 'lib/rspec-api/matchers/response/matcher.rb', line 10

def matches?(response)
  @response = response || OpenStruct.new
  status || headers || body
end