From fee69cb02150d3ce4c94b4b47751fd8959a7bf13 Mon Sep 17 00:00:00 2001 From: Josh Kalderimis Date: Wed, 27 Apr 2011 00:28:00 +0200 Subject: [PATCH] fix mass-assignment security tests, this was due to a string column limit which doesn't cause issues on sqlite --- .../cases/mass_assignment_security_test.rb | 18 +++++++++--------- activerecord/test/cases/persistence_test.rb | 12 ++++++------ 2 files changed, 15 insertions(+), 15 deletions(-) diff --git a/activerecord/test/cases/mass_assignment_security_test.rb b/activerecord/test/cases/mass_assignment_security_test.rb index 43016df479..2c051bff84 100644 --- a/activerecord/test/cases/mass_assignment_security_test.rb +++ b/activerecord/test/cases/mass_assignment_security_test.rb @@ -35,10 +35,10 @@ def test_assign_attributes_uses_default_scope_when_no_scope_is_provided p = LoosePerson.new p.assign_attributes(attributes_hash) - assert_equal nil, p.id + assert_equal nil, p.id assert_equal 'Josh', p.first_name - assert_equal 'male', p.gender - assert_equal nil, p.comments + assert_equal 'm', p.gender + assert_equal nil, p.comments end def test_assign_attributes_skips_mass_assignment_security_protection_when_without_protection_is_used @@ -47,7 +47,7 @@ def test_assign_attributes_skips_mass_assignment_security_protection_when_withou assert_equal 5, p.id assert_equal 'Josh', p.first_name - assert_equal 'male', p.gender + assert_equal 'm', p.gender assert_equal 'rides a sweet bike', p.comments end @@ -57,7 +57,7 @@ def test_assign_attributes_with_default_scope_and_attr_protected_attributes assert_equal nil, p.id assert_equal 'Josh', p.first_name - assert_equal 'male', p.gender + assert_equal 'm', p.gender assert_equal nil, p.comments end @@ -67,7 +67,7 @@ def test_assign_attributes_with_admin_scope_and_attr_protected_attributes assert_equal nil, p.id assert_equal 'Josh', p.first_name - assert_equal 'male', p.gender + assert_equal 'm', p.gender assert_equal 'rides a sweet bike', p.comments end @@ -77,7 +77,7 @@ def test_assign_attributes_with_default_scope_and_attr_accessible_attributes assert_equal nil, p.id assert_equal 'Josh', p.first_name - assert_equal 'male', p.gender + assert_equal 'm', p.gender assert_equal nil, p.comments end @@ -87,7 +87,7 @@ def test_assign_attributes_with_admin_scope_and_attr_accessible_attributes assert_equal nil, p.id assert_equal 'Josh', p.first_name - assert_equal 'male', p.gender + assert_equal 'm', p.gender assert_equal 'rides a sweet bike', p.comments end @@ -107,7 +107,7 @@ def attributes_hash { :id => 5, :first_name => 'Josh', - :gender => 'male', + :gender => 'm', :comments => 'rides a sweet bike' } end diff --git a/activerecord/test/cases/persistence_test.rb b/activerecord/test/cases/persistence_test.rb index 2044bc6e3f..7891ccfeef 100644 --- a/activerecord/test/cases/persistence_test.rb +++ b/activerecord/test/cases/persistence_test.rb @@ -493,21 +493,21 @@ def test_update_attributes def test_update_attributes_as_admin person = TightPerson.create - person.update_attributes({ "first_name" => 'Josh', "gender" => 'male', "comments" => 'from NZ' }, :as => :admin) + person.update_attributes({ "first_name" => 'Josh', "gender" => 'm', "comments" => 'from NZ' }, :as => :admin) person.reload - assert_equal 'Josh', person.first_name - assert_equal 'male', person.gender + assert_equal 'Josh', person.first_name + assert_equal 'm', person.gender assert_equal 'from NZ', person.comments end def test_update_attributes_as_without_protection person = TightPerson.create - person.update_attributes({ "first_name" => 'Josh', "gender" => 'male', "comments" => 'from NZ' }, :without_protection => true) + person.update_attributes({ "first_name" => 'Josh', "gender" => 'm', "comments" => 'from NZ' }, :without_protection => true) person.reload - assert_equal 'Josh', person.first_name - assert_equal 'male', person.gender + assert_equal 'Josh', person.first_name + assert_equal 'm', person.gender assert_equal 'from NZ', person.comments end -- GitLab