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



More info can be found here

Thiago J.

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

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs