Testing - 47primes/recipes_api GitHub Wiki

Functional tests

Set User-Agent header in setup block

setup do
  @request.env["User-Agent"] = "Recipes Android"
end

Set Content-Type header for requests via PUT and POST

@request.env["Content-Type"] = "application/json"

Creating a resource

see test/functionals/cookbooks_controller_test.rb

Listing resources

see test/functionals/cookbooks_controller_test.rb

Deleting a resource

see test/functionals/cookbooks_controller_test.rb

HTTP basic authentication

see test/functionals/sessions_controller_test.rb