[rspec-users] bypass_rescue and its inverse

Matt Patterson matt-lists at reprocessed.org
Fri Mar 20 02:46:49 EDT 2009


I've just started using rspec-rails 1.2 and the bypass rescue  
declaration is wonderful - by default I tend to write controller which  
raise exceptions (in exceptional circumstances), along with before- 
filters as guard clauses, so being able to switch off rescue from  
(which I properly spec separately) is a real boon.

Such a boon, in fact, that I immediately shoved it into a global  
before :each block so that my controller specs would do what I expect  
by default.

However, that makes my speccing of the rescue_from code a little  
trickier. Is there an easy way to do the inverse: to switch the  
default Rails behaviour back on, on command?




I guess the other option is to figure out how to declaratively spec  
rescue from (which I, and judging by forks of the  
rspec_on_rails_matchers plugin, several others figured out for before  

Bit unawake yet, may follow up with an answer to my own question when  
I've imbibed the caffeine.

   Matt Patterson | Design & Code
   <matt at reprocessed org> | http://www.reprocessed.org/

More information about the rspec-users mailing list