Forum: Ruby on Rails Functional testing - why can you use session[:key] but not s

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.
Pat M. (Guest)
on 2006-02-10 10:12
(Received via mailing list)
Question's all in the title..

def test_foo
  assert_equal 'foo', session[:bar]  # Perfectly valid
end

def test_blowup
  session[:bar] = foo # TypeError: Symbol as array index
  ...
end

I always create a @session variable in the setup method.  Just curious
as to why you can get session values but not set them using session[]

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