[rspec-users] Mocking/Stubbing ActiveRecord.config.default_timezone

James Byrne lists at ruby-forum.com
Mon Jan 26 15:08:37 EST 2009

Mark Wilden wrote:
> The thing is that the Ruby idiom is to avoid unnecessary returns. 
> Because of  this, using them actually makes code harder to read,
> because you have to read it more carefully to see if they're being
> used for a legitimate reason.

If the method is short, the code simply falls through, and I am not 
doing anything particularly subtle with the result, then I follow the 
convention of no explicit return.  If a method requires at least one 
explicit return then I code all possible outcomes as returns.  In such a 
case, one _should_ be reading the code more carefully, particularly if 
one is writing it.

But, we digress.  I am still looking for suggestions on recommended 
approaches to testing application code that is dependent upon 
environment.rb config values.

Posted via http://www.ruby-forum.com/.

More information about the rspec-users mailing list