aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test
diff options
context:
space:
mode:
authorBogdan Gusiev <agresso@gmail.com>2013-05-13 10:54:59 +0300
committerAaron Patterson <aaron.patterson@gmail.com>2013-05-16 13:31:35 -0700
commit711097e6a5af61a31a0547223038a4b5e1d59366 (patch)
tree32ba32fbfb99662a4f14a889846f1500f3f31c90 /activerecord/test
parente38c93a120de84ee5c2f22e9da942233a7edd22e (diff)
downloadrails-711097e6a5af61a31a0547223038a4b5e1d59366.tar.gz
rails-711097e6a5af61a31a0547223038a4b5e1d59366.tar.bz2
rails-711097e6a5af61a31a0547223038a4b5e1d59366.zip
Add more data to AR::UnknownAttributeError
begin Topic.new("hello" => "world") rescue ActiveRecord::UnknownAttributeError => e e.record # => #<Topic ... > e.attribute # => "hello" end
Diffstat (limited to 'activerecord/test')
-rw-r--r--activerecord/test/cases/attribute_methods_test.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/activerecord/test/cases/attribute_methods_test.rb b/activerecord/test/cases/attribute_methods_test.rb
index a181c513ae..d882d40ecb 100644
--- a/activerecord/test/cases/attribute_methods_test.rb
+++ b/activerecord/test/cases/attribute_methods_test.rb
@@ -711,6 +711,18 @@ class AttributeMethodsTest < ActiveRecord::TestCase
assert_raise(ActiveRecord::UnknownAttributeError) { @target.new.attributes = { :title => "Ants in pants" } }
end
+ def test_bulk_update_raise_unknown_attribute_errro
+ error = nil
+ begin
+ @target.new(:hello => "world")
+ rescue ActiveRecord::UnknownAttributeError => error
+ end
+ assert error
+ assert @target, error.record
+ assert "hello", error.attribute
+ assert "unknown attribute: hello", error.message
+ end
+
def test_read_attribute_overwrites_private_method_not_considered_implemented
# simulate a model with a db column that shares its name an inherited
# private method (e.g. Object#system)