aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJosef Šimánek <josef.simanek@gmail.com>2016-01-26 00:30:46 +0100
committerJosef Šimánek <josef.simanek@gmail.com>2016-01-26 00:30:49 +0100
commit20f943b5e88f2cfea0255a299c301ebafb4430b3 (patch)
tree48d716c8c279fe63f69f7bb55851762b4fa9e0bf
parent7f71b4d8a4744e26fcec7be13efb243e73ffd3ce (diff)
downloadrails-20f943b5e88f2cfea0255a299c301ebafb4430b3.tar.gz
rails-20f943b5e88f2cfea0255a299c301ebafb4430b3.tar.bz2
rails-20f943b5e88f2cfea0255a299c301ebafb4430b3.zip
Use Ruby 1.8 compat syntax in test of security fix in activerecord/test/cases/nested_attributes_test.rb.
-rw-r--r--activerecord/test/cases/nested_attributes_test.rb8
1 files changed, 4 insertions, 4 deletions
diff --git a/activerecord/test/cases/nested_attributes_test.rb b/activerecord/test/cases/nested_attributes_test.rb
index f5f0517681..0a70bb0ccd 100644
--- a/activerecord/test/cases/nested_attributes_test.rb
+++ b/activerecord/test/cases/nested_attributes_test.rb
@@ -148,15 +148,15 @@ class TestNestedAttributesInGeneral < ActiveRecord::TestCase
end
def test_reject_if_is_not_short_circuited_if_allow_destroy_is_false
- Pirate.accepts_nested_attributes_for :ship, reject_if: ->(a) { a[:name] == "The Golden Hind" }, allow_destroy: false
+ Pirate.accepts_nested_attributes_for :ship, :reject_if => lambda {|a| a[:name] == "The Golden Hind" }, :allow_destroy => false
- pirate = Pirate.create!(catchphrase: "Stop wastin' me time", ship_attributes: { name: "White Pearl", _destroy: "1" })
+ pirate = Pirate.create!(:catchphrase => "Stop wastin' me time", :ship_attributes => { :name => "White Pearl", :_destroy => "1" })
assert_equal "White Pearl", pirate.reload.ship.name
- pirate.update!(ship_attributes: { id: pirate.ship.id, name: "The Golden Hind", _destroy: "1" })
+ pirate.update_attributes(:ship_attributes => { :id => pirate.ship.id, :name => "The Golden Hind", :_destroy => "1" })
assert_equal "White Pearl", pirate.reload.ship.name
- pirate.update!(ship_attributes: { id: pirate.ship.id, name: "Black Pearl", _destroy: "1" })
+ pirate.update_attributes(:ship_attributes => { :id => pirate.ship.id, :name => "Black Pearl", :_destroy => "1" })
assert_equal "Black Pearl", pirate.reload.ship.name
end