aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport
diff options
context:
space:
mode:
authorMitesh Jain <mjain@crri.co.in>2011-05-21 17:57:48 +0530
committerMitesh Jain <mitijain123@gmail.com>2011-07-24 19:43:42 +0530
commit2c90568a066c3064b054827ac7239a57c12a5841 (patch)
tree9865ed742e8e5f4e3c8e6b155d29b1499dcc43eb /activesupport
parent8a9cacba6d9cdeeda3d31f269ed33ed422fba28d (diff)
downloadrails-2c90568a066c3064b054827ac7239a57c12a5841.tar.gz
rails-2c90568a066c3064b054827ac7239a57c12a5841.tar.bz2
rails-2c90568a066c3064b054827ac7239a57c12a5841.zip
Duplicable test is looking fine now.
Diffstat (limited to 'activesupport')
-rw-r--r--activesupport/test/core_ext/duplicable_test.rb19
1 files changed, 12 insertions, 7 deletions
diff --git a/activesupport/test/core_ext/duplicable_test.rb b/activesupport/test/core_ext/duplicable_test.rb
index 24e0ccd9b3..e48e6a7c45 100644
--- a/activesupport/test/core_ext/duplicable_test.rb
+++ b/activesupport/test/core_ext/duplicable_test.rb
@@ -4,22 +4,27 @@ require 'active_support/core_ext/object/duplicable'
require 'active_support/core_ext/numeric/time'
class DuplicableTest < Test::Unit::TestCase
- NO = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56'), Class.new, Module.new, 5.seconds]
+ RAISE_DUP = [nil, false, true, :symbol, 1, 2.3, BigDecimal.new('4.56'), 5.seconds]
YES = ['1', Object.new, /foo/, [], {}, Time.now]
+ NO = [Class.new, Module.new]
def test_duplicable
- NO.each do |v|
+ (RAISE_DUP + NO).each do |v|
assert !v.duplicable?
- begin
- v.dup
- fail
- rescue Exception
- end
end
YES.each do |v|
assert v.duplicable?
+ end
+
+ (YES + NO).each do |v|
assert_nothing_raised { v.dup }
end
+
+ RAISE_DUP.each do |v|
+ assert_raises(TypeError) do
+ v.dup
+ end
+ end
end
end