2017-07-09 08:06:36 -04:00
|
|
|
# frozen_string_literal: true
|
2017-07-10 09:39:13 -04:00
|
|
|
|
2005-02-15 11:21:56 -05:00
|
|
|
#--
|
2020-12-31 22:21:20 -05:00
|
|
|
# Copyright (c) 2005-2021 David Heinemeier Hansson
|
2005-02-15 11:21:56 -05:00
|
|
|
#
|
|
|
|
# Permission is hereby granted, free of charge, to any person obtaining
|
|
|
|
# a copy of this software and associated documentation files (the
|
|
|
|
# "Software"), to deal in the Software without restriction, including
|
|
|
|
# without limitation the rights to use, copy, modify, merge, publish,
|
|
|
|
# distribute, sublicense, and/or sell copies of the Software, and to
|
|
|
|
# permit persons to whom the Software is furnished to do so, subject to
|
|
|
|
# the following conditions:
|
|
|
|
#
|
|
|
|
# The above copyright notice and this permission notice shall be
|
|
|
|
# included in all copies or substantial portions of the Software.
|
|
|
|
#
|
|
|
|
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
|
|
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
|
|
|
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
|
|
|
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
|
|
|
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
|
|
|
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
|
|
|
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
|
|
#++
|
|
|
|
|
2016-08-06 11:58:50 -04:00
|
|
|
require "securerandom"
|
2017-10-21 09:11:29 -04:00
|
|
|
require "active_support/dependencies/autoload"
|
|
|
|
require "active_support/version"
|
|
|
|
require "active_support/logger"
|
|
|
|
require "active_support/lazy_load_hooks"
|
|
|
|
require "active_support/core_ext/date_and_time/compatibility"
|
2009-12-03 12:06:01 -05:00
|
|
|
|
|
|
|
module ActiveSupport
|
|
|
|
extend ActiveSupport::Autoload
|
|
|
|
|
2011-12-22 03:35:22 -05:00
|
|
|
autoload :Concern
|
2019-04-19 00:49:56 -04:00
|
|
|
autoload :ActionableError
|
2019-10-05 20:37:23 -04:00
|
|
|
autoload :ConfigurationFile
|
2017-05-26 14:00:27 -04:00
|
|
|
autoload :CurrentAttributes
|
2012-03-18 14:24:04 -04:00
|
|
|
autoload :Dependencies
|
2010-06-20 07:26:42 -04:00
|
|
|
autoload :DescendantsTracker
|
2016-02-21 20:25:52 -05:00
|
|
|
autoload :ExecutionWrapper
|
|
|
|
autoload :Executor
|
2010-06-20 07:26:42 -04:00
|
|
|
autoload :FileUpdateChecker
|
2015-12-08 21:07:49 -05:00
|
|
|
autoload :EventedFileUpdateChecker
|
2019-09-27 07:20:48 -04:00
|
|
|
autoload :ForkTracker
|
2010-06-24 07:23:43 -04:00
|
|
|
autoload :LogSubscriber
|
|
|
|
autoload :Notifications
|
2016-02-21 20:25:52 -05:00
|
|
|
autoload :Reloader
|
2019-09-05 07:13:09 -04:00
|
|
|
autoload :SecureCompareRotator
|
2010-06-20 07:26:42 -04:00
|
|
|
|
2009-12-22 18:27:37 -05:00
|
|
|
eager_autoload do
|
|
|
|
autoload :BacktraceCleaner
|
2012-12-07 14:13:56 -05:00
|
|
|
autoload :ProxyObject
|
2009-12-22 18:27:37 -05:00
|
|
|
autoload :Benchmarkable
|
|
|
|
autoload :Cache
|
|
|
|
autoload :Callbacks
|
|
|
|
autoload :Configurable
|
|
|
|
autoload :Deprecation
|
2017-11-29 19:27:27 -05:00
|
|
|
autoload :Digest
|
2009-12-22 18:27:37 -05:00
|
|
|
autoload :Gzip
|
|
|
|
autoload :Inflector
|
2010-03-07 09:24:30 -05:00
|
|
|
autoload :JSON
|
2012-07-03 20:37:31 -04:00
|
|
|
autoload :KeyGenerator
|
2009-12-22 18:27:37 -05:00
|
|
|
autoload :MessageEncryptor
|
|
|
|
autoload :MessageVerifier
|
|
|
|
autoload :Multibyte
|
2013-12-02 19:12:36 -05:00
|
|
|
autoload :NumberHelper
|
2009-12-22 18:27:37 -05:00
|
|
|
autoload :OptionMerger
|
|
|
|
autoload :OrderedHash
|
|
|
|
autoload :OrderedOptions
|
|
|
|
autoload :StringInquirer
|
2019-11-26 17:56:14 -05:00
|
|
|
autoload :EnvironmentInquirer
|
2011-10-19 13:59:33 -04:00
|
|
|
autoload :TaggedLogging
|
2009-12-22 18:27:37 -05:00
|
|
|
autoload :XmlMini
|
2015-03-10 01:00:37 -04:00
|
|
|
autoload :ArrayInquirer
|
2009-12-22 18:27:37 -05:00
|
|
|
end
|
2010-01-04 17:22:39 -05:00
|
|
|
|
2012-08-01 12:23:11 -04:00
|
|
|
autoload :Rescuable
|
For performance reasons, you can no longer call html_safe! on Strings. Instead, all Strings are always not html_safe?. Instead, you can get a SafeBuffer from a String by calling #html_safe, which will SafeBuffer.new(self).
* Additionally, instead of doing concat("</form>".html_safe), you can do
safe_concat("</form>"), which will skip both the flag set, and the flag
check.
* For the first pass, I converted virtually all #html_safe!s to #html_safe,
and the tests pass. A further optimization would be to try to use
#safe_concat as much as possible, reducing the performance impact if
we know up front that a String is safe.
2010-01-31 22:17:42 -05:00
|
|
|
autoload :SafeBuffer, "active_support/core_ext/string/output_safety"
|
2010-01-04 17:22:39 -05:00
|
|
|
autoload :TestCase
|
2013-12-02 19:12:36 -05:00
|
|
|
|
|
|
|
def self.eager_load!
|
|
|
|
super
|
|
|
|
|
|
|
|
NumberHelper.eager_load!
|
|
|
|
end
|
2014-09-10 23:54:43 -04:00
|
|
|
|
2014-12-18 15:41:02 -05:00
|
|
|
cattr_accessor :test_order # :nodoc:
|
Disable parallel testing when running individual files
Setting up the parallel workers could be an overhead when running
individual files.
This patch disables that process in case the number of files to run
is less than one.
Results running a sample file:
Before:
```
actionpack $ bin/test test/controller/parameters/accessors_test.rb
Run options: --seed 48261
........................................................................
Finished in 0.211923s, 339.7460 runs/s, 552.0873 assertions/s.
72 runs, 117 assertions, 0 failures, 0 errors, 0 skips
```
After
```
actionpack $ bin/test test/controller/parameters/accessors_test.rb
Run options: --seed 5461
........................................................................
Finished in 0.008411s, 8560.2189 runs/s, 13910.3557 assertions/s.
72 runs, 117 assertions, 0 failures, 0 errors, 0 skips
```
2021-02-24 17:42:34 -05:00
|
|
|
cattr_accessor :test_parallelization_disabled, default: false # :nodoc:
|
|
|
|
|
|
|
|
def self.disable_test_parallelization!
|
|
|
|
self.test_parallelization_disabled = true unless ENV["PARALLEL_WORKERS"]
|
|
|
|
end
|
2015-04-07 16:19:33 -04:00
|
|
|
|
2016-04-23 09:46:50 -04:00
|
|
|
def self.to_time_preserves_timezone
|
|
|
|
DateAndTime::Compatibility.preserve_timezone
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.to_time_preserves_timezone=(value)
|
|
|
|
DateAndTime::Compatibility.preserve_timezone = value
|
|
|
|
end
|
2017-12-29 07:47:10 -05:00
|
|
|
|
|
|
|
def self.utc_to_local_returns_utc_offset_times
|
|
|
|
DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times
|
|
|
|
end
|
|
|
|
|
|
|
|
def self.utc_to_local_returns_utc_offset_times=(value)
|
|
|
|
DateAndTime::Compatibility.utc_to_local_returns_utc_offset_times = value
|
|
|
|
end
|
2009-12-03 12:06:01 -05:00
|
|
|
end
|
2010-03-07 09:24:30 -05:00
|
|
|
|
|
|
|
autoload :I18n, "active_support/i18n"
|