2.2. Functional Testing
2.1 More HTTP methods
There is now support for all the HTTP methods as alternatives to the generic “process” for functional testing. Examples:
- Calls Controller#miletone with a GET request process :milestone
- Calls Controller#miletone with a POST request that has parameters post :milestone, { “name” => “David” }
- Calls Controller#milestone with a HEAD request that has both
- parameters and session data head :milestone, { “id” => 1 }, { “user_id” => 23 }
This is especially useful for testing actions which perform different actions on POST and GET requests or testing idiomatic REST web services.
2.2 Additional Assertions
Please welcome the following assertions to the family:
assert_flash_equal
assert_session_equal
assert_assigned_equal
All three assertions have the same parameters:
(expected, key, message)
They allow very straightforward value evaluation of their respective containers; flash, session, and assigned objects.
2.3 More Convenient Session Support
The process method now supports a Hash as an optional 3rd parameter. In the has is a key/value pair of Session variables to be used for processing the request.