Permalink
Browse files

Added a negative test. pair:jbarnette

[git-p4: depot-paths = "//src/change_class/dev/": change = 4460]
  • Loading branch information...
zenspider committed Nov 6, 2008
1 parent 0342f20 commit be284506c428441f333869a0045fd862dddd7328
Showing with 15 additions and 0 deletions.
  1. +15 −0 test/test_change_class.rb
View
@@ -13,6 +13,10 @@ def thingy
end
end
+class Thing
+ attr_accessor :name
+end
+
class TestChangeClass < Test::Unit::TestCase
def test_change_class
x = X.new
@@ -23,4 +27,15 @@ def test_change_class
assert_equal Y, x.class
assert_equal 2, x.thingy
end
+
+ def test_change_class_bork_bork_bork
+ t = Thing.new
+ t.name = "Monkeyfucker"
+ assert_equal "Monkeyfucker", t.name
+
+ t.class = Y
+ assert_raises NoMethodError do
+ t.name
+ end
+ end
end

0 comments on commit be28450

Please sign in to comment.