Permalink
Browse files

Merge pull request #1186 from mitijain123/duplicable_test

Duplicable test is looking fine now.
  • Loading branch information...
2 parents 8a9cacb + 2c90568 commit 97716e6273018c5531c7c927d226af823a0a3820 @spastorino spastorino committed Jul 24, 2011
Showing with 12 additions and 7 deletions.
  1. +12 −7 activesupport/test/core_ext/duplicable_test.rb
@@ -4,22 +4,27 @@
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

0 comments on commit 97716e6

Please sign in to comment.