module RSpecApi::Expectations::Response
Public Instance Methods
expect_response(response, expectations, prefix_params=nil, &block)
click to toggle source
# File lib/rspec-api/expectations/response.rb, line 16 def expect_response(response, expectations, prefix_params=nil, &block) expect_status response, expectations.slice(*on_status) expect_headers response, expectations.slice(*on_headers) expect_body response, expectations.slice(*on_body) expect_custom response, prefix_params, &block if block_given? end
Private Instance Methods
has_entity_body?(response)
click to toggle source
# File lib/rspec-api/expectations/response.rb, line 41 def has_entity_body?(response) !Rack::Utils::STATUS_WITH_NO_ENTITY_BODY.include?(response.status) end
on_body()
click to toggle source
# File lib/rspec-api/expectations/response.rb, line 33 def on_body [:collection, :callback, :sort, :filter, :attributes] end
on_headers()
click to toggle source
# File lib/rspec-api/expectations/response.rb, line 29 def on_headers [:type, :page_links] end
on_status()
click to toggle source
# File lib/rspec-api/expectations/response.rb, line 25 def on_status [:status] end
success?(response)
click to toggle source
# File lib/rspec-api/expectations/response.rb, line 37 def success?(response) response.status && response.status < 400 end