[rspec-users] Stubbing times: #from_now et al.

Nick Hoffman nick at deadorange.com
Wed Nov 5 15:26:13 EST 2008


On 2008-11-05, at 15:10, Mark Wilden wrote:
> What I can't figure out is this:
>
> >> 1.day
> => 1 day
>
> >> 1.day.class
> => Fixnum
>
> Is 1.day an ActiveSupport::Duration or a Fixnum?
>
> ///ark

It's an ActiveSupport::Duration :

  48         def days
  49           ActiveSupport::Duration.new(self * 24.hours, [[:days,  
self]])
  50         end
  51         alias :day :days

I've no idea why 1.day.class returns Fixnum though..


More information about the rspec-users mailing list