diff options
author | Ryuta Kamizono <kamipo@gmail.com> | 2017-12-20 21:29:43 +0900 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-12-20 21:29:43 +0900 |
commit | 5232ddad654aad7fc48fb1458c4d776246789409 (patch) | |
tree | e0702359eb3fe085673c62270bdf705a2d4e4749 /activesupport | |
parent | 8db0d36a967f51af93c79e6e9ffe472dd929281e (diff) | |
parent | 01efbc128d1379d02dd14acf324d011944a1c429 (diff) | |
download | rails-5232ddad654aad7fc48fb1458c4d776246789409.tar.gz rails-5232ddad654aad7fc48fb1458c4d776246789409.tar.bz2 rails-5232ddad654aad7fc48fb1458c4d776246789409.zip |
Merge pull request #31520 from yahonda/introduce_frozen_error_class
Handle `FrozenError` if it is available
Diffstat (limited to 'activesupport')
-rw-r--r-- | activesupport/test/abstract_unit.rb | 4 | ||||
-rw-r--r-- | activesupport/test/core_ext/hash_ext_test.rb | 2 |
2 files changed, 5 insertions, 1 deletions
diff --git a/activesupport/test/abstract_unit.rb b/activesupport/test/abstract_unit.rb index 3ac11e0fe0..f214898145 100644 --- a/activesupport/test/abstract_unit.rb +++ b/activesupport/test/abstract_unit.rb @@ -38,4 +38,8 @@ class ActiveSupport::TestCase private def jruby_skip(message = "") skip message if defined?(JRUBY_VERSION) end + + def frozen_error_class + Object.const_defined?(:FrozenError) ? FrozenError : RuntimeError + end end diff --git a/activesupport/test/core_ext/hash_ext_test.rb b/activesupport/test/core_ext/hash_ext_test.rb index 746d7ad416..17952e9fc7 100644 --- a/activesupport/test/core_ext/hash_ext_test.rb +++ b/activesupport/test/core_ext/hash_ext_test.rb @@ -446,7 +446,7 @@ class HashExtTest < ActiveSupport::TestCase original.freeze assert_nothing_raised { original.except(:a) } - assert_raise(RuntimeError) { original.except!(:a) } + assert_raise(frozen_error_class) { original.except!(:a) } end def test_except_does_not_delete_values_in_original |