aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/hash_ext_test.rb
Commit message (Collapse)AuthorAgeFilesLines
* Missing require AS/core_ext/date/conversionsAkira Matsuda2019-08-021-0/+1
|
* Fix rubocop violationsyuuji.yaginuma2019-02-091-2/+2
|
* Add 'Hash#deep_transform_values', and 'Hash#deep_transform_values!'Guillermo Iguaran2019-02-081-0/+27
|
* No need to handle if FrozenError is availableYasuo Honda2018-12-231-1/+1
| | | | | | | Rails 6 requires Ruby 2.5, which introduces `FrozenError` https://docs.ruby-lang.org/en/2.5.0/NEWS.html Related to #31520
* Follow up #34754bogdanvlviv2018-12-201-28/+6
| | | | | | | - Fix a few deprecation warnings - Remove testing of `Hash#slice` - Imporve test of `Hash#slice!` - Remove mention about `Hash#slice` from the guide
* Remove remaining tests for `Hash#transform_keys` and `Hash#transform_keys!`Ryuta Kamizono2018-12-211-27/+0
| | | | Follow up #34761.
* Deprecate `active_support/core_ext/hash/compact`yuuji.yaginuma2018-03-021-34/+4
| | | | | Ruby 2.4+ provides `Hash#compact` and `Hash#compact!` natively, so `active_support/core_ext/hash/compact` is no longer necessary.
* Use assert_predicate and assert_not_predicateDaniel Colson2018-01-251-3/+3
|
* Handle `FrozenError` if it is availableYasuo Honda2017-12-201-1/+1
| | | | | | | | | | | | | | | This pull request handles `FrozenError` introduced by Ruby 2.5. Refer https://bugs.ruby-lang.org/projects/ruby-trunk/repository/revisions/61131 Since `FrozenError` is a subclass of `RuntimeError` minitest used by master branch can handle it, though it would be better to handle `FrozenError` explicitly if possible. `FrozenError` does not exist in Ruby 2.4 or lower, `frozen_error_class` handles which exception is expected to be raised. This pull request is intended to be merged to master, then backported to `5-1-stable` to address #31508
* Merge branch 'master' into make-reverse-merge-bang-order-consistentSean Griffin2017-07-171-702/+17
|\
| * [Active Support] `rubocop -a --only Layout/EmptyLineAfterMagicComment`Koichi ITO2017-07-111-0/+1
| |
| * Use frozen-string-literal in ActiveSupportKir Shatrov2017-07-091-0/+1
| |
| * Revert "Merge pull request #29540 from kirs/rubocop-frozen-string"Matthew Draper2017-07-021-1/+0
| | | | | | | | | | This reverts commit 3420a14590c0e6915d8b6c242887f74adb4120f9, reversing changes made to afb66a5a598ce4ac74ad84b125a5abf046dcf5aa.
| * Enforce frozen string in RubocopKir Shatrov2017-07-011-0/+1
| |
| * Move HashWithIndifferentAccess tests to separate fileMichael Stock2017-03-301-712/+0
| |
| * Add aliases for reverse_merge to with_defaultsMatt Casper2017-03-291-0/+25
| | | | | | | | | | | | In the context of controller parameters, reverse_merge is commonly used to provide defaults for user input. Having an alias to reverse_merge called with_defaults feels more idiomatic for Rails.
* | Make the order of Hash#reverse_merge! consistent with HashWithIndifferentAccessErol Fornoles2017-03-061-2/+5
|/
* Add few tests for the top level `HashWithIndifferentAccess`Robin Dupret2017-02-251-0/+24
| | | | | This ensures that if we try to hard-deprecate it again in the future, we won't break these behaviors.
* Soft-deprecate the top-level HashWithIndifferentAccess classRobin Dupret2017-02-251-0/+4
| | | | | | | Since using a `ActiveSupport::Deprecation::DeprecatedConstantProxy` would prevent people from inheriting this class and extending it from the `ActiveSupport::HashWithIndifferentAccess` one would break the ancestors chain, that's the best option we have here.
* Make HWIA#compact not return nil when no nilsPavel Pravosud2017-02-231-0/+10
|
* Revert "Merge pull request #27925 from robin850/hwia-removal"Kasper Timm Hansen2017-02-201-23/+0
| | | | | | | | | Pointed out by @matthewd that the HWIA subclass changes the AS scoped class and top-level HWIA hierarchies out from under existing classes. This reverts commit 71da39097b67114329be6d8db7fe6911124531af, reversing changes made to 41c33bd4b2ec3f4a482e6030b6fda15091d81e4a.
* Deprecate the top-level `HashWithIndifferentAccess` contantRobin Dupret2017-02-191-0/+23
| | | | | | | | | This constant was kept for the sake of backward compatibility; it is still available under `ActiveSupport::HashWithIndifferentAccess`. Furthermore, since Ruby 2.5 (https://bugs.ruby-lang.org/issues/11547) won't support top level constant lookup, people would have to update their code anyway.
* ensure `#compact` of HWIDA to return HWIDAyuuji.yaginuma2017-01-061-0/+10
| | | | | | | | `Hash#compact` of Ruby native returns new hash. Therefore, in order to return HWIDA as in the past version, need to define own `#compact` to HWIDA. Related: #26868
* Fix Rubocop violations and fix documentation visibilityRafael Mendonça França2016-12-281-1/+1
| | | | | | Some methods were added to public API in 5b14129d8d4ad302b4e11df6bd5c7891b75f393c and they should be not part of the public API.
* assert_equal takes expectation firstAkira Matsuda2016-12-261-21/+21
|
* "Use assert_nil if expecting nil from ...:in `...'. This will fail in ↵Akira Matsuda2016-12-251-2/+2
| | | | minitest 6."
* Expectation firstAkira Matsuda2016-12-251-4/+4
|
* "Use assert_nil if expecting nil from ...:in `...'. This will fail in MT6."Akira Matsuda2016-12-251-1/+1
|
* "Use assert_nil if expecting nil. This will fail in minitest 6."Akira Matsuda2016-12-251-6/+6
|
* Remove deprecated new_from_hash_copying_defaultAndrew White2016-11-131-7/+0
|
* Add more rubocop rules about whitespacesRafael Mendonça França2016-10-291-12/+12
|
* improve error message when include assertions failMichael Grosser2016-09-161-34/+34
| | | | | | assert [1, 3].includes?(2) fails with unhelpful "Asserting failed" message assert_includes [1, 3], 2 fails with "Expected [1, 3] to include 2" which makes it easier to debug and more obvious what went wrong
* Add three new rubocop rulesRafael Mendonça França2016-08-161-64/+64
| | | | | | | | Style/SpaceBeforeBlockBraces Style/SpaceInsideBlockBraces Style/SpaceInsideHashLiteralBraces Fix all violations in the repository.
* Add `Style/EmptyLines` in `.rubocop.yml` and remove extra empty linesRyuta Kamizono2016-08-071-1/+0
|
* remove redundant curlies from hash argumentsXavier Noria2016-08-061-11/+11
|
* modernizes hash syntax in activesupportXavier Noria2016-08-061-143/+143
|
* applies new string literal convention in activesupport/testXavier Noria2016-08-061-150/+150
| | | | | The current code base is not uniform. After some discussion, we have chosen to go with double quotes by default.
* existant => existentAbhishek Jain2016-06-091-1/+1
|
* Improve Hash#compact! documentation and testsIgor Pstyga2016-06-031-0/+8
| | | | | | | Make it clear what should be returned when no changes were made to the hash. { c: true }.compact! # => nil
* Support for unified Integer class in Ruby 2.4+Jeremy Daer2016-05-181-17/+17
| | | | | | | | Ruby 2.4 unifies Fixnum and Bignum into Integer: https://bugs.ruby-lang.org/issues/12005 * Forward compat with new unified Integer class in Ruby 2.4+. * Backward compat with separate Fixnum/Bignum in Ruby 2.2 & 2.3. * Drops needless Fixnum distinction in docs, preferring Integer.
* Fix regression in `Hash#dig` for HashWithIndifferentAccess.Jon Moss2016-02-011-0/+6
|
* Match HashWithIndifferentAccess#default's behaviour with Hash#defaultDavid Cornu2016-01-071-2/+2
|
* :scissors:Rafael Mendonça França2015-10-301-1/+0
|
* Deprecate `HWIDA.new_from_hash_copying_default`Sean Griffin2015-10-291-1/+1
| | | | This method was already niche, and is now redundant with `.new`
* Merge pull request #16357 from gchan/hwia-respects-to-hash-defaultSean Griffin2015-10-291-0/+18
|\ | | | | | | | | `HashWithIndifferentAccess.new` respects the default value or proc on objects that respond to `#to_hash`
| * `HashWithIndifferentAccess.new` respects the default value or proc on ↵Gordon Chan2014-07-311-0/+18
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | objects that respond to `#to_hash`. Builds on the work of #12550 where `.new` will convert the object (that respond to `#to_hash`) to a hash and add that hash's keys and values to itself. This change will also make `.new` respect the default value or proc of objects that respond to `#to_hash`. In other words, this `.new` behaves exactly like `.new_from_hash_copying_default`. `.new_from_hash_copying_default` now simply invokes `.new` and any references to `.new_from_hash_copying_default` are replaced with `.new`. Added tests confirm behavior.
* | ActiveSupport::HashWithIndifferentAccess select and reject should return ↵Bernard Potocki2015-07-171-0/+10
| | | | | | | | enumerator if called without block
* | Reuse the same test for HWIA reverse_merge!Rafael Mendonça França2015-07-101-3/+1
| |
* | Merge pull request #20828 from Sirupsen/hash-indifferent-dup-default-procRafael Mendonça França2015-07-101-0/+37
|\ \ | | | | | | active_support/indifferent_access: fix not raising when default_proc does
| * | test/hash: move lonely indifferent hash testSimon Eskildsen2015-07-101-0/+6
| | |