Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

TypeError: can't convert ActiveSupport::TimeWithZone into time #61

Closed
greyblake opened this Issue · 7 comments

5 participants

@greyblake

Steps to reproduce:

Timecop.freeze(Time.zone.now)
# => TypeError: can't convert ActiveSupport::TimeWithZone into time

Code which causes the issue:

ae1ed2c#L1R54

@mikz

I might be same as #60

@glebm

This breaks for me with can't convert ActiveSupport::TimeWithZone into Integer (on jruby)
It appears to be trying to call :to_int internally and failing

@travisjeffery

Yep, I'm gonna deal with this sometime shortly today.

@greyblake

yes, it's a duplication of #60. Sorry.

@greyblake greyblake closed this
@travisjeffery travisjeffery referenced this issue from a commit
@travisjeffery fallback to giving Time#at the float representation of the Time objec…
…t if the Ruby implementation can't handle a Time object (fix #60, fix #61)
f867814
@travisjeffery travisjeffery referenced this issue from a commit
@travisjeffery fallback to giving Time#at the float representation of the Time objec…
…t if the Ruby implementation can't handle a Time object (fix #60, fix #61)
68ec6ad
@travisjeffery

Just released v0.5.8 which fixes this.

@matpowel

I still get the same problem as @glebm on JRuby? Seems to make TimeCop unusable on JRuby but it could actually be a ruby_units problem..

require "rubygems"
=> false
require "active_utils"
=> true
require "timecop"
=> true
Timecop.travel(2.days.ago)
=> Wed Mar 06 16:49:15 -0700 2013
require "ruby_units"
=> true
Timecop.travel(2.days.ago)
TypeError: can't convert Time into Integer
    from org/jruby/RubyTime.java:983:in `at'
    from .../jruby-1.7.3@.../bundler/gems/ruby-units-323853496e1f/lib/ruby_units/time.rb:22:in `at'
    from .../jruby-1.7.3@.../gems/timecop-0.5.9.2/lib/timecop/time_stack_item.rb:65:in `time'
    from .../jruby-1.7.3@.../gems/timecop-0.5.9.2/lib/timecop/time_extensions.rb:6:in `mock_time'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.