aboutsummaryrefslogtreecommitdiffstats
path: root/activerecord/test/cases/nested_attributes_test.rb
diff options
context:
space:
mode:
authorThomas Walpole <twalpole@gmail.com>2015-07-23 06:49:03 -0700
committerThomas Walpole <twalpole@gmail.com>2015-11-03 11:34:07 -0800
commit85f7d955f31209605cccd4cca64be93eec9782f1 (patch)
treeaff4442837d7f5622accfaee0d07d7d6a2a08c1d /activerecord/test/cases/nested_attributes_test.rb
parente670611e6002039231a24d547f9a6e053940fb16 (diff)
downloadrails-85f7d955f31209605cccd4cca64be93eec9782f1.tar.gz
rails-85f7d955f31209605cccd4cca64be93eec9782f1.tar.bz2
rails-85f7d955f31209605cccd4cca64be93eec9782f1.zip
Update and fix forbidden attributes tests
Add AC::Parameters tests for WhereChain#not
Diffstat (limited to 'activerecord/test/cases/nested_attributes_test.rb')
-rw-r--r--activerecord/test/cases/nested_attributes_test.rb35
1 files changed, 0 insertions, 35 deletions
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb
index 93cb631a04..0b700afcb4 100644
--- a/activerecord/test/cases/nested_attributes_test.rb
+++ b/activerecord/test/cases/nested_attributes_test.rb
@@ -1068,39 +1068,4 @@ class TestHasManyAutosaveAssociationWhichItselfHasAutosaveAssociations < ActiveR
assert_not part.valid?
assert_equal ["Ship name can't be blank"], part.errors.full_messages
end
-
- class ProtectedParameters
- def initialize(hash)
- @hash = hash
- end
-
- def permitted?
- true
- end
-
- def [](key)
- @hash[key]
- end
-
- def to_h
- @hash
- end
- end
-
- test "strong params style objects can be assigned for singular associations" do
- params = { name: "Stern", ship_attributes:
- ProtectedParameters.new(name: "The Black Rock") }
- part = ShipPart.new(params)
-
- assert_equal "Stern", part.name
- assert_equal "The Black Rock", part.ship.name
- end
-
- test "strong params style objects can be assigned for collection associations" do
- params = { trinkets_attributes: ProtectedParameters.new("0" => ProtectedParameters.new(name: "Necklace"), "1" => ProtectedParameters.new(name: "Spoon")) }
- part = ShipPart.new(params)
-
- assert_equal "Necklace", part.trinkets[0].name
- assert_equal "Spoon", part.trinkets[1].name
- end
end