aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib/active_support/testing
diff options
context:
space:
mode:
authorT.J. Schuck <tj@getharvest.com>2017-04-18 12:28:34 -0400
committerT.J. Schuck <tj@getharvest.com>2017-04-18 15:43:01 -0400
commit1d82b7ce7c96b86e8ef44b2eba12bccd2bd14331 (patch)
tree8adfd170bc654ba3e4a7b6e3108f76849a618bb0 /activesupport/lib/active_support/testing
parent8776a7139757d0b264785c774d4e7f37d4bc1ac7 (diff)
downloadrails-1d82b7ce7c96b86e8ef44b2eba12bccd2bd14331.tar.gz
rails-1d82b7ce7c96b86e8ef44b2eba12bccd2bd14331.tar.bz2
rails-1d82b7ce7c96b86e8ef44b2eba12bccd2bd14331.zip
Explicitly require AS::Time in AS::Testing::TimeHelpers
If you just try to use `ActiveSupport::Testing::TimeHelpers` standalone by requiring `active_support/testing/time_helpers`, you currently get an error: `NoMethodError: undefined method `change' for 2017-12-14 01:04:44 -0500:Time` 9f6e82ee4783e491c20f5244a613fdeb4024beb5 added a dependency on `AS::Time` by using `AS::Time#change`. Here's a script to reproduce the error: ```ruby require "bundler/inline" gemfile(true) do source "https://rubygems.org" gem "activesupport", github: "rails/rails" end require "active_support/testing/time_helpers" require "minitest/autorun" class BugTest < Minitest::Test include ActiveSupport::Testing::TimeHelpers def test_stuff travel_to Time.new(2017, 12, 14, 01, 04, 44) do assert true end end end ``` It currently fails for all 5.x.x versions and master. Ideally, this would be backported to `5-0-stable` and `5-1-stable` as well.
Diffstat (limited to 'activesupport/lib/active_support/testing')
-rw-r--r--activesupport/lib/active_support/testing/time_helpers.rb1
1 files changed, 1 insertions, 0 deletions
diff --git a/activesupport/lib/active_support/testing/time_helpers.rb b/activesupport/lib/active_support/testing/time_helpers.rb
index 07c9be0604..3d9ff99729 100644
--- a/activesupport/lib/active_support/testing/time_helpers.rb
+++ b/activesupport/lib/active_support/testing/time_helpers.rb
@@ -1,4 +1,5 @@
require "active_support/core_ext/string/strip" # for strip_heredoc
+require "active_support/core_ext/time/calculations"
require "concurrent/map"
module ActiveSupport