Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
greyblake opened this issue Jan 8, 2013 · 7 comments
Closed

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

greyblake opened this issue Jan 8, 2013 · 7 comments

Comments

@greyblake
Copy link

Steps to reproduce:

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

Code which causes the issue:

ae1ed2c#L1R54

@mikz
Copy link

mikz commented Jan 8, 2013

I might be same as #60

@glebm
Copy link

glebm commented Jan 8, 2013

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
Copy link
Owner

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

@greyblake
Copy link
Author

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

travisjeffery pushed a commit that referenced this issue Jan 9, 2013
…t if the Ruby implementation can't handle a Time object (fix #60, fix #61)
travisjeffery pushed a commit that referenced this issue Jan 9, 2013
…t if the Ruby implementation can't handle a Time object (fix #60, fix #61)
@travisjeffery
Copy link
Owner

Just released v0.5.8 which fixes this.

@greyblake
Copy link
Author

Thanks @travisjeffery!

@matpowel
Copy link

matpowel commented Mar 8, 2013

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
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants