aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/lib
Commit message (Collapse)AuthorAgeFilesLines
...
* | | | Merge pull request #33822 from y-yagi/do_not_check_parents_dor_directoriesYuji Yaginuma2018-12-211-2/+22
|\ \ \ \ | |/ / / |/| | | Do no watch parent directory of `dirs`
| * | | Do not add parent directory to file system monitoringyuuji.yaginuma2018-12-181-2/+22
| | |/ | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | `EventedFileUpdateChecker` will search the parent directory if the specified directory does not exist. Since `test/mailers/previews` is included in the watch target by default, if there is no test directory (e.g. using `rspec`), the Rails root directory will be included in the watch target. ``` $ rails new app $ cd app $ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)" false $ rm -rf test $ ./bin/rails r "p Rails.application.reloaders.last.send(:directories_to_watch).include?(Rails.root)" true ``` This causes `node_modules` to be included in watch target. Adding parent directories to watch target may include unexpected directories. In order to avoid this, fixed that parents of nonexistent directories are not added to the watch targets, instead checking that the directory exists when checking changes. Related to #32700. [Matthew Draper & Yuji Yaginuma]
* | | Merge pull request #34762 from bogdanvlviv/fix-a-few-deprecation-warningsKasper Timm Hansen2018-12-203-3/+3
|\ \ \ | |_|/ |/| | Follow up #34754
| * | Follow up #34754bogdanvlviv2018-12-203-3/+3
| | | | | | | | | | | | | | | | | | | | | - Fix a few deprecation warnings - Remove testing of `Hash#slice` - Imporve test of `Hash#slice!` - Remove mention about `Hash#slice` from the guide
* | | Module#{define_method,alias_method,undef_method,remove_method} become public ↵Ryuta Kamizono2018-12-212-8/+8
|/ / | | | | | | | | | | since Ruby 2.5 https://bugs.ruby-lang.org/issues/14133
* | Use native `Array#append`, `Array#prepend`, `Hash#transform_keys`, and ↵Ryuta Kamizono2018-12-204-37/+2
| | | | | | | | | | | | | | | | | | | | `Hash#transform_keys!` Since Rails 6 requires Ruby 2.5. https://github.com/ruby/ruby/blob/ruby_2_5/NEWS Follow up #34754.
* | Require Ruby 2.5 for Rails 6.Kasper Timm Hansen2018-12-192-31/+6
| | | | | | | | | | | | | | | | | | | | Generally followed the pattern for https://github.com/rails/rails/pull/32034 * Removes needless CI configs for 2.4 * Targets 2.5 in rubocop * Updates existing CHANGELOG entries for fewer merge conflicts * Removes Hash#slice extension as that's inlined on Ruby 2.5. * Removes the need for send on define_method in MethodCallAssertions.
* | Add option to set parallel test worker count to the physical core count of ↵Bogdan2018-12-181-2/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | the machine (#34735) * Add option to set parallel test worker count to the physical core count of the machine Also, use the physical core count of the machine as the default number of workers, and generate the `test_helper.rb` file with `parallelize(workers: :number_of_processors)` Closes #34734 * Ensure that we always test parallel testing Since #34734 we decided to use the physical core count of the machine as the default number of workers in the parallel testing, we need to ensure that some tests use at least 2 workers because we could run those tests on VM that has only 1 physical core. It also fixes tests failures on the CI since Travis server we are using has only one physical core. See https://travis-ci.org/rails/rails/jobs/469281088#L2352
* | Extend documentation of `ActiveSupport::Notifications.subscribe` (#34721)Bogdan2018-12-171-1/+8
|/ | | | | | | | | | | * Extend documentation of `ActiveSupport::Notifications.subscribe` Add mention that a block with only one argument passed to the method will yield an event object. Related to #33451 * Emphasize that `SubscribeEventObjects` is a test class by adding suffix `Test`
* Merge pull request #34648 from y-yagi/fixes_34646Yuji Yaginuma2018-12-121-14/+24
|\ | | | | Make `deprecate` work for non-exists methods
| * Make `deprecate` work for non-exists methodsyuuji.yaginuma2018-12-071-14/+24
| | | | | | | | | | | | | | | | Before #33325, `deprecate` works for non-exist methods. This is necessary, for example, if want to deprecate dynamically defined methods like attributes methods. Fixes #34646
* | Upgrade Rubocop to 0.61.1 and fix offensesVinicius Stock2018-12-102-28/+29
|/
* Another Ruby 2.6 BigDecimal compatibility issueutilum2018-12-041-1/+1
| | | | | | | | | This patch modifies XmlMini::Parsing["decimal"] to handle a string that contains an invalid number. Since [ruby/ruby@a0e438c#diff-6b866d482baf2bdfd8433893fb1f6d36R144](https://github.com/ruby/ruby/commit/a0e438cd3c28d2eaf4efa18243d5b6edafa14d88#diff-6b866d482baf2bdfd8433893fb1f6d36R144) this case raises an `ArgumentError`. `String.to_f` returns 0.0 if there is not a valid number at the start of the argument, so current behavior is conserved. See https://travis-ci.org/rails/rails/jobs/463180341#L6264 Related: #34600, #34601
* Don't expose internal `clock_gettime_supported?` class methodRyuta Kamizono2018-11-301-1/+2
|
* Do nothing when the same block is included again.Mark J. Titorenko2018-11-291-3/+7
| | | | | | | | | If the same block is included multiple times, we no longer raise an exception or overwrite the included block instance variable. Fixes #14802. [Mark J. Titorenko + Vlad Bokov]
* Pass the test reporter by referenceyuuji.yaginuma2018-11-281-0/+1
| | | | | | | | | | | This prevents the array from being dumped as a DRbObject so we can reduce communication with the server. In DRb, if `Marshal.dump` fails, `Marshal.dump` is executed again after converting the object to `DRbObject`. This also possible to reduce the execution of `Marshal.dump` by converting to a format that can be marshalized in advance using `DRbObject`. This is the same approach to Action Pack's parallel test. Ref: 5751b7ea58d7cf259dda30fb42fff51fc6ae93d5
* Remove unnecessary reduce in Duration#inspectDaniel Colson2018-11-241-1/+0
| | | | | | | | | | | | | When the `Duration` class was introduced in 276c9f29, the `parts` were represented as an array of arrays (for example `[[:seconds, 5], [:days, 3], [:seconds, 7]]`). At that time the `reduce` in `#inspect` made sense, since we would need to get the totals for each part (the example would become `{ seconds: 12, days: 3 }`). With the current version of `Duration` we call `to_h` on the `parts` immediately on initialize, so now the `reduce` doesn't seem to be doing anything meaningful.
* Merge pull request #34037 from reitermarkus/atomic_write-permissionsRafael França2018-11-221-1/+1
|\ | | | | `atomic_write`: Ensure correct permission when `tmpdir` is the same as `dirname`.
| * Ensure correct permission when `tmpdir` is the same as `dirname`.Markus Reiter2018-10-021-1/+1
| |
* | Remove odd spaces [ci skip]Ryuta Kamizono2018-11-211-2/+2
| |
* | Merge pull request #34497 from 6temes/make_documentation_for_slice_more_explicitRafael França2018-11-201-2/+3
|\ \ | | | | | | Expand documentation for Hash#slice!
| * | Improve documentation for Hash#slice!Daniel Lopez 👾2018-11-211-2/+3
| | |
* | | Deprecate `event.end = Time.now` in favor of `event.finish!`Ryuta Kamizono2018-11-201-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | Since #33449, `event.end = Time.now` is not used anymore and should use `event.finish!`. We can't use `deprecate :end=` in definition time in this module due to circular require in `active_support/deprecation/behaviors`.
* | | Merge pull request #34410 from gmcgibbon/test_support_windowsEileen M. Uchitelle2018-11-192-2/+7
|\ \ \ | | | | | | | | Windows support for parallelization and instrumenter
| * | | Windows support for parallelization and instrumenterGannon McGibbon2018-11-082-2/+7
| |/ / | | | | | | | | | | | | Add Windows support for `ActiveSupport::Testing::Parallelization` and `ActiveSupport::Notifications::Instrumenter`.
* / / Correctly handle unknown object in parallel testsyuuji.yaginuma2018-11-171-0/+2
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | DRb wraps in `DRbUnknown` if the data contains a type that can not be resolved locally. This can happen if an error occurs in the test and the error class can not be resolved on the server side. When this happens, an instance of `DRbUnknown` is passed to the `result` of `Server#record`. This causes another error(undefined method assertions for #<DRb::DRbUnknown:> (NoMethodError)) in `reporter.record`. This can confirm by the following steps. ``` $ rails new app -B --dev; cd app $ rails g scaffold user name:string $ edit `config.action_controller.allow_forgery_protection = true` in environments/test.rb $ bin/rails t ``` In the case of `DRbUnknown` occurs, can't resolve error exception. So wrap exception with `DRbRemoteError` in the same way as an unmarshalled object.
* | Merge pull request #34131 from lsylvester/defend-against-unmarshable-exceptionsEileen M. Uchitelle2018-11-051-1/+8
|\ \ | | | | | | Fix DRb::DRbServerNotFound errors in parallel tests
| * | resque errors caused by Marshal dump failures and wrap exceptions in ↵Lachlan Sylvester2018-10-091-1/+8
| | | | | | | | | | | | marshallable DRbRemoteError
* | | Make #to_options an alias for #symbolize_keysNick Weiland2018-11-011-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Fixes #34359 Prior to 5.2.0 (2cad8d7), HashWithIndifferentAccess#to_options acted as an alias to HashWithIndifferentAccess#symbolize_keys. Now, #to_options returns an instance of HashWithIndifferentAccess while #symbolize_keys returns and instance of Hash. This pr makes it so HashWithIndifferentAccess#to_options acts as an alias for HashWithIndifferentAccess#symbolize_keys once again.
* | | Missing require "active_support/executor"Akira Matsuda2018-10-301-0/+1
| | |
* | | Missing require "core_ext/module/attribute_accessors"Akira Matsuda2018-10-301-0/+1
| | |
* | | Missing require "active_support/concern"Akira Matsuda2018-10-301-0/+2
| | |
* | | Merge pull request #34334 from ↵Ryuta Kamizono2018-10-291-2/+3
|\ \ \ | | | | | | | | | | | | | | | | albertoalmagro/privatize-constants-activesupport-timezone Privatize and add # :nodoc: to constants
| * | | Privatize and add # :nodoc: to constantsAlberto Almagro2018-10-281-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | Both `UTC_OFFSET_WITH_COLON` and `UTC_OFFSET_WITHOUT_COLON` are only used within `ActiveSupport::TimeZone` and in my opinion they do not provide relevant information that should appear in the docs.
* | | | Improve the logic that detects non-autoloaded constantsJan Habermann2018-10-281-1/+5
|/ / / | | | | | | | | | | | | | | | | | | If you require `nokogiri` from `app/models/user.rb`, dependencies.rb does not mark `Nokogiri` as an autoloaded constant, as expected. But the logic to detect these non-autoloaded constants is incomplete. See the tests defined in the patch for some cases incorrectly handled.
* | | Merge pull request #34208 from yskkin/inspect_with_parameter_filterRyuta Kamizono2018-10-261-22/+40
|\ \ \ | | | | | | | | Implement AR#inspect using ParameterFilter
| * | | Implement AR#inspect using ParamterFilter.Yoshiyuki Kinjo2018-10-191-22/+40
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | AR instance support `filter_parameters` since #33756. Though Regex or Proc is valid as `filter_parameters`, they are not supported as AR#inspect. I also add :mask option and #filter_params to `ActiveSupport::ParameterFilter#new` to implement this.
* | | | `assert_called_with` should require `args` argumentbogdanvlviv2018-10-251-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | There are two main reasons why `assert_called_with` should require `args` argument: 1) If we want to assert that some method should be called and we don't need to check with which arguments it should be called then we should use `assert_called`. 2) `assert_called_with` without `args` argument doesn't assert anything! ```ruby assert_called_with(@object, :increment) do @object.decrement end ``` It causes false assertions in tests that could cause regressions in the project. I found this bug by working on [minitest-mock_expectations](https://github.com/bogdanvlviv/minitest-mock_expectations) gem. This gem is an extension for minitest that provides almost the same method call assertions. I was wondering whether you would consider adding "minitest-mock_expectations" to `rails/rails` instead of private `ActiveSupport::Testing::MethodCallAssertions` module. If yes, I'll send a patch - https://github.com/bogdanvlviv/rails/commit/a970ecc42c3a9637947599f2c13e3762e4b59208
* | | | Merge pull request #34034 from runephilosof/patch-2Gannon McGibbon2018-10-241-0/+3
|\ \ \ \ | | | | | | | | | | Make it easier to find abort documentation
| * | | | Make it easier to find abort documentationRune Philosof2018-10-011-0/+3
| | |_|/ | |/| | | | | | Make sure how to abort is documented on https://api.rubyonrails.org/classes/ActiveSupport/Callbacks.html
* | | | Add docs to ActiveSupport::Notifications.subscribeChris Fung2018-10-221-0/+18
| | | | | | | | | | | | | | | | [ci skip]
* | | | Rename event variableAlberto Almagro2018-10-211-4/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Improve variable naming by renaming from `e` to `event`. The arguments to rename this are: * The naming `e` is usually a convention used for exceptions. * No other method in this class uses the naming `e`. All other methods are using `event`.
* | | | Use String#truncate_bytes inside Multibyte::Chars#limitFrancesco Rodríguez2018-10-201-13/+1
| | | |
* | | | Consistently use kwargs for `instance_{reader,writer,accessor}` optionsRyuta Kamizono2018-10-202-19/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Since #29294, `mattr_acessor` uses kwargs for `instance_reader`, `instance_writer`, and `instance_accessor` options. `thread_mattr_accessor` and `config_accessor` also take the same options, so let's maintain these options handles the same.
* | | | Missing require "active_support/number_helper/number_converter"Akira Matsuda2018-10-207-0/+14
| | | |
* | | | Missing require "concurrent/hash"Akira Matsuda2018-10-201-0/+1
| | | |
* | | | Missing require "active_support/callbacks"Akira Matsuda2018-10-201-0/+2
| | | |
* | | | ActiveSupport module may not always already defined hereAkira Matsuda2018-10-202-150/+154
| | | | | | | | | | | | | | | | `ruby -ractive_support/core_ext/range/conversions.rb -ep` dies with uninitialized constant ActiveSupport
* | | | Missing require "active_support/dependencies/autoload"Akira Matsuda2018-10-201-0/+2
| | | |
* | | | attribute_accessors no longer uses extract_options since ↵Akira Matsuda2018-10-201-2/+0
| | | | | | | | | | | | | | | | a5b0c60714e1e8d8c182af830a26e1c7c884271d