how to test exception?

def rescue_action_in_public(exception)
      case exception
        when LoginException
          headers["Status"] = "401 Unauthorized"

so I

def login!
  raise LoginException

but I don't know how to test it under functionals test

when ran rake test:functionals always show me exception so can't to test
step 2 goto_login

You can use ruby's assert_raise method

assert_raise LoginException do
  # whatever

More info can be found here

thx It's very useful for me
在 2008-05-06二的 19:16 -0700,Thiago Jackiw写道: