Comments (3)
Same thing with Timecop.travel
.
from timecop.
I have tested this with:
$ rails console
Loading development environment (Rails 3.1.0)
ruby-1.9.2-p290 :001 > [Date.yesterday, Date.today, Date.tomorrow]
=> [Mon, 26 Dec 2011, Tue, 27 Dec 2011, Wed, 28 Dec 2011]
ruby-1.9.2-p290 :002 > Timecop.freeze(Date.today + 30)
=> 2012-01-26 00:00:00 -0600
ruby-1.9.2-p290 :003 > [Date.yesterday, Date.today, Date.tomorrow]
=> [Wed, 25 Jan 2012, Thu, 26 Jan 2012, Fri, 27 Jan 2012]
and with a test in test/test_timecop.rb test_freeze_changes_and_resets_time():
require 'rails/all'
each_timezone do
(1..12).each do |month|
date = Date.new(2011, month, 28)
Timecop.freeze(date) do
twenty_nine_days_from_today = Date.today + 29
thirty_days_from_today = Date.today + 30
thirty_one_days_from_today = Date.today + 31
Timecop.freeze(thirty_days_from_today) do
assert_equal twenty_nine_days_from_today, Date.yesterday
assert_equal thirty_days_from_today, Date.today
assert_equal thirty_one_days_from_today, Date.tomorrow
end
end
end
end
but, that returns successfully. Do you have a test that reproduces this error?
Environment
ruby-1.9.2-p290
rails (3.1.0)
activesupport (3.1.0)
timecop (0.3.5)
from timecop.
I can't reproduce this either, if you can make a test that can please reopen or make a new issue please.
from timecop.
Related Issues (20)
- Is call to Timecop.travel(some random time) atomic in nature? HOT 1
- Time#travel should be side-effect free and not resume system clock HOT 10
- .
- Timecop.thread_safe = true by default HOT 1
- Timecop handles GMT/UTC Time objects incorrectly HOT 2
- Doesn't work for `Rails.cache` with `expires_in` HOT 2
- ruby 3.1 support
- Date.strptime returns wrong month for %Y HOT 6
- %W is not handled properly HOT 1
- Ruby 2.5 seems to work? HOT 4
- Using timecop with psych 4.0.5, behavior differs between the test environment and other environments HOT 3
- Timecop.scale to mock existing times HOT 2
- Timecop.freeze not working with expect().to receive HOT 3
- Test
- Need a proper test for making sure we don't change timezones inadvertently
- DateTime parse without date not working properly HOT 5
- DateTime.parse("Wednesday 12:00") format is always returning midnight HOT 1
- Time.now sometimes has greater-than-nanosecond precision when called under Timecop.travel HOT 3
- DateTime.parse does not handle CWeek correctly
- Mocking `Process.clock_gettime` causes `Concurrent::IVar` with timeout to wait indefinitely HOT 5
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from timecop.