[rspec-users] Mocking/Stubbing ActiveRecord.config.default_timezone
Mark Wilden
mark at mwilden.com
Mon Jan 26 10:57:52 EST 2009
On Mon, Jan 26, 2009 at 7:23 AM, James Byrne <lists at ruby-forum.com> wrote:
> return true if (effective_from <= time_now and
> (not superseded_after or superseded_after >= time_now
> ))
> return false
>
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').
Carry on. :)
///ark
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20090126/90bc6f5c/attachment.html>
More information about the rspec-users
mailing list