diff options
author | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-12-07 09:24:50 +0900 |
---|---|---|
committer | yuuji.yaginuma <yuuji.yaginuma@gmail.com> | 2016-12-13 07:35:36 +0900 |
commit | 2cb855812066b64e7e10e40096a4c4e8e8256afb (patch) | |
tree | 77daf403b7f9673928bd34800f9aefc162595147 /activesupport/test | |
parent | 1373f9bdcf725f75832dc7401994cc76113a8a4e (diff) | |
download | rails-2cb855812066b64e7e10e40096a4c4e8e8256afb.tar.gz rails-2cb855812066b64e7e10e40096a4c4e8e8256afb.tar.bz2 rails-2cb855812066b64e7e10e40096a4c4e8e8256afb.zip |
change return value of `duplicable?` with Ruby 2.4+
`NilClass`, `FalseClass`, `TrueClass`, `Symbol` and `Numeric` can dup
with Ruby 2.4+.
Ref: https://bugs.ruby-lang.org/issues/12979
Diffstat (limited to 'activesupport/test')
-rw-r--r-- | activesupport/test/core_ext/object/duplicable_test.rb | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/object/duplicable_test.rb b/activesupport/test/core_ext/object/duplicable_test.rb index 154a10c1b3..c2a1e68f57 100644 --- a/activesupport/test/core_ext/object/duplicable_test.rb +++ b/activesupport/test/core_ext/object/duplicable_test.rb @@ -4,8 +4,13 @@ require "active_support/core_ext/object/duplicable" require "active_support/core_ext/numeric/time" class DuplicableTest < ActiveSupport::TestCase - RAISE_DUP = [method(:puts)] - ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56")] + if RUBY_VERSION >= "2.4.0" + RAISE_DUP = [method(:puts)] + ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56"), nil, false, true, :symbol, 1, 2.3] + else + RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, method(:puts)] + ALLOW_DUP = ["1", Object.new, /foo/, [], {}, Time.now, Class.new, Module.new, BigDecimal.new("4.56")] + end def test_duplicable rubinius_skip "* Method#dup is allowed at the moment on Rubinius\n" \ |