Home > rails, ruby > Rails Note #8: Testing with session variables

Rails Note #8: Testing with session variables

November 18th, 2008 rupert Leave a comment Go to comments

Taken from http://guides.rails.info/testing_rails_applications.html

The get method kicks off the web request and populates the results into the response. It accepts 4 arguments:

*The action of the controller you are requesting. This can be in the form of a string or a symbol.
*An optional hash of request parameters to pass into the action (eg. query string parameters or post variables).
*An optional hash of session variables to pass along with the request.
*An optional hash of flash values.

Example: Calling the :show action, passing an id of 12 as the params and setting a user_id of 5 in the session:

get(:show, {'id' => "12"}, {'user_id' => 5})
Categories: rails, ruby Tags: ,
  1. No comments yet.
You must be logged in to post a comment.