Module: RSpecApi::Matchers::Response

Included in:
RSpecApi::Matchers
Defined in:
lib/rspec-api/matchers/response/matcher.rb,
lib/rspec-api/matchers/response/be_a_valid_response.rb

Defined Under Namespace

Classes: Matcher

Instance Method Summary collapse

Instance Method Details

#be_a_valid_responseObject

Passes if the object has either a status, headers or a body.

Examples:

Passes if the response has a status

require 'rspec-api-matchers'

obj = OpenStruct.new status: 100

describe 'be_a_valid_response' do
  include RSpecApi::Matchers::Response
  it { expect(obj).to be_a_valid_response }
end

# => (rspec) 1 example, 0 failures

See Also:



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

def be_a_valid_response
  RSpecApi::Matchers::Response::Matcher.new
end