Testing Endpoints

You can, of course, just test your full stack by using your existing web testing framework. If you want to test endpoints directly, Apia provides a few useful tools that you can use to faciliate this.

response = CoreAPI::Base.test_endpoint(described_class, :create) do |req|
  req.json_body[:user] = { user: 'blah' }
end

response.status     # => 201
response.body       # => { ... }
response.headers    # => { ... }
Edit this page on GitHub Updated at Mon, Mar 18, 2024