diff options
author | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-20 09:51:22 -0700 |
---|---|---|
committer | Aaron Patterson <aaron.patterson@gmail.com> | 2012-03-20 09:51:22 -0700 |
commit | 440559f661b55c9cd0492469a31c8b3647ca670a (patch) | |
tree | 9664d4ec7c5b7e2a5d9a18b339035e5b0d7b94dd /activesupport/test/core_ext | |
parent | ae88ec4ddafe2604de504a7932693952f3c5aaac (diff) | |
download | rails-440559f661b55c9cd0492469a31c8b3647ca670a.tar.gz rails-440559f661b55c9cd0492469a31c8b3647ca670a.tar.bz2 rails-440559f661b55c9cd0492469a31c8b3647ca670a.zip |
bigdecimal can be duped on Ruby 2.0
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r-- | activesupport/test/core_ext/duplicable_test.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/activesupport/test/core_ext/duplicable_test.rb b/activesupport/test/core_ext/duplicable_test.rb index 3e54266051..1105353e45 100644 --- a/activesupport/test/core_ext/duplicable_test.rb +++ b/activesupport/test/core_ext/duplicable_test.rb @@ -4,17 +4,25 @@ require 'active_support/core_ext/object/duplicable' require 'active_support/core_ext/numeric/time' class DuplicableTest < ActiveSupport::TestCase - RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56'), 5.seconds] + RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, 5.seconds] YES = ['1', Object.new, /foo/, [], {}, Time.now] NO = [Class.new, Module.new] + begin + bd = BigDecimal.new('4.56') + YES << bd.dup + rescue TypeError + RAISE_DUP << bd + end + + def test_duplicable (RAISE_DUP + NO).each do |v| assert !v.duplicable? end YES.each do |v| - assert v.duplicable? + assert v.duplicable?, "#{v.class} should be duplicable" end (YES + NO).each do |v| |