aboutsummaryrefslogtreecommitdiffstats
path: root/activemodel/test
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2012-09-01 22:36:27 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2012-09-16 23:58:21 -0500
commit9bfa13bb06d510b95f9af27bf12abf031f9af0a5 (patch)
tree59ac0ae191f1f0350d73d477841c6c2bf35cff59 /activemodel/test
parent91bcebbdef0e31d38622785a064d023272f712db (diff)
downloadrails-9bfa13bb06d510b95f9af27bf12abf031f9af0a5.tar.gz
rails-9bfa13bb06d510b95f9af27bf12abf031f9af0a5.tar.bz2
rails-9bfa13bb06d510b95f9af27bf12abf031f9af0a5.zip
attr_accessible and attr_protected raise an exception pointing to use plugin or new protection model
Diffstat (limited to 'activemodel/test')
-rw-r--r--activemodel/test/cases/deprecated_mass_assignment_security_test.rb16
-rw-r--r--activemodel/test/models/project.rb3
2 files changed, 19 insertions, 0 deletions
diff --git a/activemodel/test/cases/deprecated_mass_assignment_security_test.rb b/activemodel/test/cases/deprecated_mass_assignment_security_test.rb
new file mode 100644
index 0000000000..c1fe8822cd
--- /dev/null
+++ b/activemodel/test/cases/deprecated_mass_assignment_security_test.rb
@@ -0,0 +1,16 @@
+require 'cases/helper'
+require 'models/project'
+
+class DeprecatedMassAssignmentSecurityTest < ActiveModel::TestCase
+ def test_attr_accessible_raise_error
+ assert_raise RuntimeError, /protected_attributes/ do
+ Project.attr_accessible :username
+ end
+ end
+
+ def test_attr_protected_raise_error
+ assert_raise RuntimeError, /protected_attributes/ do
+ Project.attr_protected :username
+ end
+ end
+end
diff --git a/activemodel/test/models/project.rb b/activemodel/test/models/project.rb
new file mode 100644
index 0000000000..581b6dc0b3
--- /dev/null
+++ b/activemodel/test/models/project.rb
@@ -0,0 +1,3 @@
+class Project
+ include ActiveModel::DeprecatedMassAssignmentSecurity
+end