aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord
diff options
context:
space:
mode:
authorAaron Patterson <aaron.patterson@gmail.com>2011-04-27 14:32:49 -0700
committerAaron Patterson <aaron.patterson@gmail.com>2011-04-27 14:32:49 -0700
commite190569cfb9a8cef2acaba947c579f883b254935 (patch)
treeb82691e2ff1f81d99c4b60b3507d22541031e7b4 /activerecord
parent9f6cafd5fd43b551f30b28d276713791c5098b3c (diff)
parent78e581bd2f415b7a49e0fb7538ff6309b5ef2fdb (diff)
downloadrails-e190569cfb9a8cef2acaba947c579f883b254935.tar.gz
rails-e190569cfb9a8cef2acaba947c579f883b254935.tar.bz2
rails-e190569cfb9a8cef2acaba947c579f883b254935.zip
Merged pull request #325 from joshk/mass_assignment_tests_fixed.
final corrections to the mass-assignment security tests
Diffstat (limited to 'activerecord')
-rw-r--r--activerecord/test/cases/persistence_test.rb14
1 files changed, 7 insertions, 7 deletions
diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb
index 5567602a26..b066575af8 100644
--- a/activerecord/test/cases/persistence_test.rb
+++ b/activerecord/test/cases/persistence_test.rb
@@ -492,7 +492,7 @@ class PersistencesTest < ActiveRecord::TestCase
end
def test_update_attributes_as_admin
- person = TightPerson.create
+ person = TightPerson.create({ "first_name" => 'Joshua' })
person.update_attributes({ "first_name" => 'Josh', "gender" => 'm', "comments" => 'from NZ' }, :as => :admin)
person.reload
@@ -501,8 +501,8 @@ class PersistencesTest < ActiveRecord::TestCase
assert_equal 'from NZ', person.comments
end
- def test_update_attributes_as_without_protection
- person = TightPerson.create
+ def test_update_attributes_without_protection
+ person = TightPerson.create({ "first_name" => 'Joshua' })
person.update_attributes({ "first_name" => 'Josh', "gender" => 'm', "comments" => 'from NZ' }, :without_protection => true)
person.reload
@@ -532,8 +532,8 @@ class PersistencesTest < ActiveRecord::TestCase
Reply.reset_callbacks(:validate)
end
- def test_update_attributes_as_admin
- person = TightPerson.create
+ def test_update_attributes_with_bang_as_admin
+ person = TightPerson.create({ "first_name" => 'Joshua' })
person.update_attributes!({ "first_name" => 'Josh', "gender" => 'm', "comments" => 'from NZ' }, :as => :admin)
person.reload
@@ -542,8 +542,8 @@ class PersistencesTest < ActiveRecord::TestCase
assert_equal 'from NZ', person.comments
end
- def test_update_attributes_as_without_protection
- person = TightPerson.create
+ def test_update_attributestes_with_bang_without_protection
+ person = TightPerson.create({ "first_name" => 'Joshua' })
person.update_attributes!({ "first_name" => 'Josh', "gender" => 'm', "comments" => 'from NZ' }, :without_protection => true)
person.reload