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

James Byrne lists at ruby-forum.com
Mon Jan 26 12:06:24 EST 2009


Mark Wilden wrote:
> On Mon, Jan 26, 2009 at 7:23 AM, James Byrne <lists at ruby-forum.com> 
> wrote:

> 
> This has nothing to do with your question - just a style suggestion:
> 
>  effective_from <= time_now and (superseded_after.nil? or 
> superseded_after = time_now)
> 
> No need to use 'return'. And you don't want to check if superseded_after 
> is false - just nil (if it's false, there's a bug that would be hidden by 
> 'not superseded').
> 

I prefer the style of explicit returns.  It makes intent unambiguous. 
Your point wrt nil? is well taken and I have modified the code to use 
this idiom.
-- 
Posted via http://www.ruby-forum.com/.


More information about the rspec-users mailing list