aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/associations
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2012-07-17 02:34:57 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2012-09-16 23:58:19 -0500
commit8020f71df120f80fd7db9ab568c8d0d6d1ad4e28 (patch)
tree5e6fa3226871f385f0a154d566ddaf0b713f49a4 /activerecord/test/cases/associations
parentf8c9a4d3e88181cee644f91e1342bfe896ca64c6 (diff)
downloadrails-8020f71df120f80fd7db9ab568c8d0d6d1ad4e28.tar.gz
rails-8020f71df120f80fd7db9ab568c8d0d6d1ad4e28.tar.bz2
rails-8020f71df120f80fd7db9ab568c8d0d6d1ad4e28.zip
Remove mass assignment security from ActiveRecord
Diffstat (limited to 'activerecord/test/cases/associations')
-rw-r--r--activerecord/test/cases/associations/has_many_associations_test.rb22
-rw-r--r--activerecord/test/cases/associations/has_many_through_associations_test.rb15
-rw-r--r--activerecord/test/cases/associations/has_one_associations_test.rb16
3 files changed, 0 insertions, 53 deletions
diff --git a/activerecord/test/cases/associations/has_many_associations_test.rb b/activerecord/test/cases/associations/has_many_associations_test.rb
index 5edabb4790..83128628ef 100644
--- a/activerecord/test/cases/associations/has_many_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_associations_test.rb
@@ -188,28 +188,6 @@ class HasManyAssociationsTest < ActiveRecord::TestCase
assert_equal invoice.id, line_item.invoice_id
end
- def test_association_conditions_bypass_attribute_protection
- car = Car.create(:name => 'honda')
-
- bulb = car.frickinawesome_bulbs.new
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.frickinawesome_bulbs.new(:frickinawesome => false)
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.frickinawesome_bulbs.build
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.frickinawesome_bulbs.build(:frickinawesome => false)
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.frickinawesome_bulbs.create
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.frickinawesome_bulbs.create(:frickinawesome => false)
- assert_equal true, bulb.frickinawesome?
- end
-
# When creating objects on the association, we must not do it within a scope (even though it
# would be convenient), because this would cause that scope to be applied to any callbacks etc.
def test_build_and_create_should_not_happen_within_scope
diff --git a/activerecord/test/cases/associations/has_many_through_associations_test.rb b/activerecord/test/cases/associations/has_many_through_associations_test.rb
index 36e5ba9660..50a40739b9 100644
--- a/activerecord/test/cases/associations/has_many_through_associations_test.rb
+++ b/activerecord/test/cases/associations/has_many_through_associations_test.rb
@@ -58,21 +58,6 @@ class HasManyThroughAssociationsTest < ActiveRecord::TestCase
assert post.reload.people(true).include?(person)
end
- def test_associate_existing_with_strict_mass_assignment_sanitizer
- SecureReader.mass_assignment_sanitizer = :strict
-
- SecureReader.new
-
- post = posts(:thinking)
- person = people(:david)
-
- assert_queries(1) do
- post.secure_people << person
- end
- ensure
- SecureReader.mass_assignment_sanitizer = :logger
- end
-
def test_associate_existing_record_twice_should_add_to_target_twice
post = posts(:thinking)
person = people(:david)
diff --git a/activerecord/test/cases/associations/has_one_associations_test.rb b/activerecord/test/cases/associations/has_one_associations_test.rb
index 8bc633f2b5..a7ec0f2709 100644
--- a/activerecord/test/cases/associations/has_one_associations_test.rb
+++ b/activerecord/test/cases/associations/has_one_associations_test.rb
@@ -446,22 +446,6 @@ class HasOneAssociationsTest < ActiveRecord::TestCase
assert_equal pirate.id, ship.pirate_id
end
- def test_association_conditions_bypass_attribute_protection
- car = Car.create(:name => 'honda')
-
- bulb = car.build_frickinawesome_bulb
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.build_frickinawesome_bulb(:frickinawesome => false)
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.create_frickinawesome_bulb
- assert_equal true, bulb.frickinawesome?
-
- bulb = car.create_frickinawesome_bulb(:frickinawesome => false)
- assert_equal true, bulb.frickinawesome?
- end
-
def test_new_is_called_with_attributes_and_options
car = Car.create(:name => 'honda')