I am trying to set the time zone on one rspec test in this way:
zone = ActiveSupport::TimeZone.new('Hawaii')
Time.stub(:now) { Time.now.in_time_zone(zone) }
This gives me a stack level too deep error, what am I missing here?
Try doing this:
zone = ActiveSupport::TimeZone.new('Hawaii')
Time.stub(:now){ Time.new.in_time_zone(zone) }
I am not sure, but it seems like stubbing now
and then calling Time.now
in block is causing stack level too deep error.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With