Section 7. RESTful Tests

Two new methods, put and delete, have been added to functional tests for testing RESTful controllers. These methods behave the same way as get and post, and do not interact with routes.rb. Therefore, they are really nothing more than a naming convention to make it apparent to users that put and delete are used for these actions. They are in no way a mandate that put and delete must be used. The syntax for put and delete, which is the same as the syntax for get and post, is shown in the following.

image

In integration tests, put and delete behave as would be expected. The path to the resource is specified, and routing determines ...

Get Rails Refactoring to Resources: Using CRUD and REST in Your Rails Application 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.