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

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
2b2c2a705ed12f8fb327c7b4c56456c6?d=identicon&s=25 Sean Hussey (seanhussey)
on 2006-02-02 19: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.

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

Error:
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?

Thanks,

Sean
This topic is locked and can not be replied to.