Take the 2-minute tour ×  I'm writing tests for a Ruby Rails
application, and I have a block of code that is supposed to
catch an error thrown by my Redis server if Ruby cannot connect
to it. Currently, the code looks like this:
config.before(:all) { Resque.redis.select 1 }
config.after(:all) { Resque.redis.keys("queue:*").each { |key|
Resque.redis.del key } } rescue Exception  According to the
stack trace when I try to run the tests, the second line of that
code snippet -- config.before(:all) {...} -- throws a
Redis::CannotConnectError. After a lot of
"e.class.superclass.superclass..." commands, I determined that
this error inherited from StandardError.  After that I got
stuck. I tried catching the error with "rescue
Redis::CannotConnectError", then "rescue", and finally "rescue
Exception", but the error is still thrown. However, I tried the
same things in the Ruby command prompt, and the exception was
caught every time  Could anyone help me work out what's
happening here? Thanks!  share|improve thi