diff options
author | David Heinemeier Hansson <david@loudthinking.com> | 2008-04-30 23:14:32 -0500 |
---|---|---|
committer | David Heinemeier Hansson <david@loudthinking.com> | 2008-04-30 23:14:32 -0500 |
commit | dd120ede53eaf71dee76894998a81626b7a689fc (patch) | |
tree | f9bcc98eba07ebfdb662489321b4e1d184020f57 /activerecord/test/cases/validations_test.rb | |
parent | c83f75812ef89aea1b8d138aebec25de8057f156 (diff) | |
download | rails-dd120ede53eaf71dee76894998a81626b7a689fc.tar.gz rails-dd120ede53eaf71dee76894998a81626b7a689fc.tar.bz2 rails-dd120ede53eaf71dee76894998a81626b7a689fc.zip |
Added block-setting of attributes for Base.create like Base.new already has (Adam Meehan) [#39 state:resolved]
Diffstat (limited to 'activerecord/test/cases/validations_test.rb')
-rwxr-xr-x | activerecord/test/cases/validations_test.rb | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/activerecord/test/cases/validations_test.rb b/activerecord/test/cases/validations_test.rb index ca36ad3581..e3ca8660ac 100755 --- a/activerecord/test/cases/validations_test.rb +++ b/activerecord/test/cases/validations_test.rb @@ -133,6 +133,22 @@ class ValidationsTest < ActiveRecord::TestCase Reply.create!([ { "title" => "OK" }, { "title" => "Wrong Create" }]) end end + + def test_exception_on_create_bang_with_block + assert_raises(ActiveRecord::RecordInvalid) do + Reply.create!({ "title" => "OK" }) do |r| + r.content = nil + end + end + end + + def test_exception_on_create_bang_many_with_block + assert_raises(ActiveRecord::RecordInvalid) do + Reply.create!([{ "title" => "OK" }, { "title" => "Wrong Create" }]) do |r| + r.content = nil + end + end + end def test_scoped_create_without_attributes Reply.with_scope(:create => {}) do |