From a8ed46bfb13928a8d73350746cb96aa6b1438346 Mon Sep 17 00:00:00 2001 From: Sebastian Martinez Date: Sun, 17 Apr 2011 21:09:42 -0300 Subject: [PATCH] Class and Module are dupicable --- .../active_support/core_ext/object/duplicable.rb | 12 ------------ activesupport/test/core_ext/duplicable_test.rb | 8 +++----- 2 files changed, 3 insertions(+), 17 deletions(-) diff --git a/activesupport/lib/active_support/core_ext/object/duplicable.rb b/activesupport/lib/active_support/core_ext/object/duplicable.rb index b053257..154c845 100644 --- a/activesupport/lib/active_support/core_ext/object/duplicable.rb +++ b/activesupport/lib/active_support/core_ext/object/duplicable.rb @@ -51,15 +51,3 @@ class Numeric #:nodoc: false end end - -class Class #:nodoc: - def duplicable? - false - end -end - -class Module #:nodoc: - def duplicable? - false - end -end diff --git a/activesupport/test/core_ext/duplicable_test.rb b/activesupport/test/core_ext/duplicable_test.rb index 6e1f876..e3376fc 100644 --- a/activesupport/test/core_ext/duplicable_test.rb +++ b/activesupport/test/core_ext/duplicable_test.rb @@ -3,16 +3,14 @@ require 'bigdecimal' require 'active_support/core_ext/object/duplicable' class DuplicableTest < Test::Unit::TestCase - NO = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56'), Class.new] - YES = ['1', Object.new, /foo/, [], {}, Time.now] + NO = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56')] + YES = ['1', Object.new, /foo/, [], {}, Time.now, Class.new, Module.new] def test_duplicable NO.each do |v| assert !v.duplicable? - begin + assert_raises(TypeError, "can't dup #{v.class}") do v.dup - fail - rescue Exception end end -- 1.7.4.2