HTTP DELETE

No surprises here with HTTP DELETE. All we do here is send an HTTP DELETE request along with the ID of the permit we would like to delete.

images/rest/delete.png

In this case, we can delete the test permit set up for us in setup and then verify it’s gone by searching for it after:

 test ​'HTTP DELETE'​ ​do
  delete permit_path(@permit)
  assert_response ​:redirect
 
  assert_raises(ActiveRecord::RecordNotFound) ​do
  get permit_path(@permit)
 end
 end

Get The Way of the Web Tester now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.