aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/module_test.rb
diff options
context:
space:
mode:
authorT.J. Schuck <tj@tjschuck.com>2017-11-28 17:49:54 -0500
committerT.J. Schuck <tj@tjschuck.com>2017-11-28 17:49:54 -0500
commit333ff24b8524094d55badb6c7f42f4b53832c0b6 (patch)
tree632cfb228f523cfea9b63140cee60c7455cbf8f4 /activesupport/test/core_ext/module_test.rb
parent8633567169bb7b7bbab1ec8ddf6fe140d6db2e99 (diff)
downloadrails-333ff24b8524094d55badb6c7f42f4b53832c0b6.tar.gz
rails-333ff24b8524094d55badb6c7f42f4b53832c0b6.tar.bz2
rails-333ff24b8524094d55badb6c7f42f4b53832c0b6.zip
Refactor Date/Time next_occurring and prev_occurring
These methods were originally added in https://github.com/rails/rails/pull/26600 This includes a couple of refactors to make these methods behave more similarly to other Date/Time extensions added by Active Support: 1. Use `advance` instead of `since` and `ago` to time-travel — this is particularly important to keep the returned instance’s class matching `self`. Before this change: today = Date.today # => Tue, 28 Nov 2017 today.class # => Date today.next_occurring(:wednesday) # => Wed, 29 Nov 2017 00:00:00 UTC +00:00 today.next_occurring(:wednesday).class # => ActiveSupport::TimeWithZone After this change, a Date (or Time, or DateTime) instance is properly returned (just like is shown in the new docs). This is generally how everything else in DateAndTime::Calculations works. 2. Move the tests from the DateTime tests to the DateAndTimeBehavior tests. The latter location is mixed in to the core_ext tests for _all_ of Date, Time, and DateTime to test the behavior across all of the classes. The previous location is for testing core_ext functionality added specifically just to DateTime. 3. Better docs!
Diffstat (limited to 'activesupport/test/core_ext/module_test.rb')
0 files changed, 0 insertions, 0 deletions