Does anybody have any examples of using minitest and reacktest together to create request specs?
I want to be able to request a resource:
get '/api/resource', format: :json
And then test the response.
Does anybody have any examples of using minitest and reacktest together to create request specs?
I want to be able to request a resource:
get '/api/resource', format: :json
And then test the response.
You can simply use rack-test, as you suggested! Write your specs/unit-tests and with rack-test you can do:
def test_api_ressource_json
get "/api/resource.json"
assert last_response.ok?
assert last_response.body.include?("something")
# Test whatever you like with last_response.body
end
And that should be it.