aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext')
-rw-r--r--activesupport/test/core_ext/duplicable_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/duplicable_test.rb b/activesupport/test/core_ext/duplicable_test.rb
new file mode 100644
index 0000000000..7f8c0f7d3b
--- /dev/null
+++ b/activesupport/test/core_ext/duplicable_test.rb
@@ -0,0 +1,22 @@
+require File.dirname(__FILE__) + '/../abstract_unit'
+
+class DuplicableTest < Test::Unit::TestCase
+ NO = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56')]
+ YES = ['1', Object.new, /foo/, [], {}]
+
+ def test_duplicable
+ NO.each do |v|
+ assert !v.duplicable?
+ begin
+ v.dup
+ fail
+ rescue Exception
+ end
+ end
+
+ YES.each do |v|
+ assert v.duplicable?
+ assert_nothing_raised { v.dup }
+ end
+ end
+end