1
0
Fork 0
mirror of https://github.com/rails/rails.git synced 2022-11-09 12:12:34 -05:00
rails--rails/activesupport/test
claudiob d43b1b0a9e Add necessary 'require reverse_merge' to HAWI.rb
Hashes with indifferent access should support `reverse_merge` out-of-the-box
but they don't; for instance the following code fails:

```ruby
require 'active_support'
require 'active_support/hash_with_indifferent_access'
hash = HashWithIndifferentAccess.new key: :old_value
hash.reverse_merge key: :new_value
```

This PR fixes the case above by simply requiring
`active_support/core_ext/hash/reverse_merge` in `hash_with_indifferent_access.rb`
and adding a test that confirms the fix.

---

Here are more details about the bugfix.
Currently, `reverse_merge` is [defined in HashWithIndifferentAccess](4e8ea13ba1/activesupport/lib/active_support/hash_with_indifferent_access.rb (L208))
by invoking `super`, that is by invoking `Hash#reverse_merge`:

```ruby
def reverse_merge(other_hash)
  super(self.class.new_from_hash_copying_default(other_hash))
end
```

However, Ruby's `Hash` does not have the `reverse_merge` by default: it must be
added by ActiveSupport, and that requires the following line of code to be
present:

```ruby
require 'active_support/core_ext/hash/reverse_merge'
```
2014-10-17 09:11:04 -07:00
..
autoloading_fixtures
core_ext define hash on duration 2014-10-03 19:53:54 +10:00
dependencies
deprecation
fixtures
json Merge pull request #15856 from zuhao/refactor_activesupport_decoding_test 2014-06-22 13:47:25 +02:00
notifications
testing Use safe_constantize. 2014-09-02 00:41:00 +08:00
xml_mini
abstract_unit.rb Default to sorting user's test cases for now 2014-09-08 05:32:16 -07:00
autoload_test.rb fix autoload tests 2014-10-05 20:28:36 +03:00
benchmarkable_test.rb
broadcast_logger_test.rb
caching_test.rb Keep the first string we fetch 2014-08-27 01:04:56 +09:30
callback_inheritance_test.rb
callbacks_test.rb
class_cache_test.rb
clean_backtrace_test.rb missing activesupport test coverage 2014-07-19 17:15:40 -07:00
clean_logger_test.rb
concern_test.rb
configurable_test.rb
constantize_test_cases.rb Use safe_constantize. 2014-09-02 00:41:00 +08:00
dependencies_test.rb Use safe_constantize. 2014-09-02 00:41:00 +08:00
dependencies_test_helpers.rb
deprecation_test.rb Keep quietly and capture undeprecated on your suite 2014-07-15 17:56:27 -03:00
descendants_tracker_test_cases.rb
descendants_tracker_with_autoloading_test.rb
descendants_tracker_without_autoloading_test.rb
file_update_checker_test.rb
gzip_test.rb
hash_with_indifferent_access_test.rb Add necessary 'require reverse_merge' to HAWI.rb 2014-10-17 09:11:04 -07:00
i18n_test.rb
inflector_test.rb Replace Enumerable#reverse.each with Enumerable#reverse_each 2014-10-13 11:47:16 +01:00
inflector_test_cases.rb Fix for inflector's incorrect camelCase replacement for acronyms 2014-09-06 04:56:25 +09:30
key_generator_test.rb missing activesupport test coverage 2014-07-19 17:15:40 -07:00
lazy_load_hooks_test.rb
load_paths_test.rb
log_subscriber_test.rb
logger_test.rb
message_encryptor_test.rb
message_verifier_test.rb MessageVerifier raises an appropriate exception if the secret is nil 2014-09-12 15:09:00 +02:00
multibyte_chars_test.rb "warning: assigned but unused variable" 2014-08-19 19:31:18 +09:00
multibyte_conformance_test.rb fix thread safety issues 2014-07-17 15:36:42 -07:00
multibyte_proxy_test.rb missing activesupport test coverage 2014-07-19 17:15:40 -07:00
multibyte_test_helpers.rb Avoid mutating the constants in a test case 2014-08-16 10:23:50 +09:00
multibyte_unicode_database_test.rb
notifications_test.rb
number_helper_i18n_test.rb
number_helper_test.rb Fixes the digits counter of AS's NumberToRoundedConverter 2014-08-20 16:25:35 +02:00
option_merger_test.rb Add implicit receiver support to Object#with_options 2014-07-29 16:11:48 -04:00
ordered_hash_test.rb
ordered_options_test.rb
rescuable_test.rb
safe_buffer_test.rb
string_inquirer_test.rb
subscriber_test.rb Fix assertion arguments order 2014-07-31 08:56:22 -03:00
tagged_logging_test.rb
test_case_test.rb Default to sorting user's test cases for now 2014-09-08 05:32:16 -07:00
time_travel_test.rb Move date and time requires to time_travel_test, also include 2014-08-19 13:17:23 -07:00
time_zone_test.rb Use Hash#each_key instead of Hash#keys.each 2014-09-29 17:27:10 +02:00
time_zone_test_helpers.rb Extract out with_env_tz helper method. 2014-06-18 19:46:04 +08:00
transliterate_test.rb [ci skip] use proper apostrophe 2014-08-25 22:03:31 +05:30
xml_mini_test.rb