aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/attribute_methods_test.rb
diff options
context:
space:
mode:
authorMike Gunderloy <MikeG1@larkfarm.com>2008-10-25 14:49:39 +0530
committerPratik Naik <pratiknaik@gmail.com>2008-10-25 14:52:44 +0530
commit5c97d4ff29cfd944da751f01177a3024626d57bb (patch)
tree4142a8173f00fa3ff1e03e513d18aeef89be3042 /activerecord/test/cases/attribute_methods_test.rb
parent5cf932344a4482a0cfbda57e9f69ebe64e70a261 (diff)
downloadrails-5c97d4ff29cfd944da751f01177a3024626d57bb.tar.gz
rails-5c97d4ff29cfd944da751f01177a3024626d57bb.tar.bz2
rails-5c97d4ff29cfd944da751f01177a3024626d57bb.zip
"raise NoMethodError" raises NoMethodError. Raise it with NoMethodError.new instead.
Signed-off-by: Pratik Naik <pratiknaik@gmail.com>
Diffstat (limited to 'activerecord/test/cases/attribute_methods_test.rb')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb11
1 files changed, 7 insertions, 4 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index 160716f944..77ee8d8fc4 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -233,8 +233,9 @@ class AttributeMethodsTest < ActiveRecord::TestCase
topic = @target.new(:title => "The pros and cons of programming naked.")
assert !topic.respond_to?(:title)
- assert_raise(NoMethodError) { topic.title }
- topic.send(:title)
+ exception = assert_raise(NoMethodError) { topic.title }
+ assert_equal "Attempt to call private method", exception.message
+ assert_equal "I'm private", topic.send(:title)
end
def test_write_attributes_respect_access_control
@@ -242,7 +243,8 @@ class AttributeMethodsTest < ActiveRecord::TestCase
topic = @target.new
assert !topic.respond_to?(:title=)
- assert_raise(NoMethodError) { topic.title = "Pants"}
+ exception = assert_raise(NoMethodError) { topic.title = "Pants"}
+ assert_equal "Attempt to call private method", exception.message
topic.send(:title=, "Very large pants")
end
@@ -251,7 +253,8 @@ class AttributeMethodsTest < ActiveRecord::TestCase
topic = @target.new(:title => "Isaac Newton's pants")
assert !topic.respond_to?(:title?)
- assert_raise(NoMethodError) { topic.title? }
+ exception = assert_raise(NoMethodError) { topic.title? }
+ assert_equal "Attempt to call private method", exception.message
assert topic.send(:title?)
end