module RSpecApi::Expectations::Response::Body

Creates an example group for expectations on the response body of the last API request and runs it to verify that it matches best practices:

Public Instance Methods

expect_body(response, expectations = {}) click to toggle source
# File lib/rspec-api/expectations/body.rb, line 19
def expect_body(response, expectations = {})
  context 'responds with a body that' do
    extend Collection
    extend Jsonp
    extend Sort
    extend Filter
    extend Attributes

    expect_a_collection response, expectations
    expect_a_callback_wrapped response, expectations
    expect_a_sorted response, expectations
    expect_a_filtered response, expectations
    expect_attributes response, expectations
  end if expectations.any?
end