Forum: Ruby on Rails Setting and testing session data within a test.

Announcement (2017-05-07): is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see and for other Rails- und Ruby-related community platforms.
Sean H. (Guest)
on 2006-02-02 20:59
(Received via mailing list)
Hi everyone,

One of my actions depends on some session data being set.  When I try
to set the data in a test case, I get an error.

session[:conditions] = [  "LOWER(username) LIKE :bad_name",
                              { :bad_name => "asdasdasd" } ]

TypeError: Symbol as array index
    test/functional/personnel_controller_test.rb:43:in `[]='

How can I set session data in a test?

In normal use, the data is set in one action, which then redirects to
another action.  Can I test 2 actions?  Work with one action,
redirect_to the other, and then test the resulting page?


This topic is locked and can not be replied to.