aboutsummaryrefslogtreecommitdiffstats
path: root/actionpack/test/controller
diff options
context:
space:
mode:
authorGuillermo Iguaran <guilleiguaran@gmail.com>2012-08-29 10:08:58 -0500
committerGuillermo Iguaran <guilleiguaran@gmail.com>2012-09-16 23:58:21 -0500
commit1e1bee3ab985e47fae49d9fd5d2ca946f5d9c533 (patch)
tree48d7d3e0fb65093896b9f43c887644f89c313c5b /actionpack/test/controller
parent8cfe95d7194a1118f9950fe1d81a4e915cb929d6 (diff)
downloadrails-1e1bee3ab985e47fae49d9fd5d2ca946f5d9c533.tar.gz
rails-1e1bee3ab985e47fae49d9fd5d2ca946f5d9c533.tar.bz2
rails-1e1bee3ab985e47fae49d9fd5d2ca946f5d9c533.zip
Change tainted/untainted wording to permitted/forbidden
Diffstat (limited to 'actionpack/test/controller')
-rw-r--r--actionpack/test/controller/parameters/parameters_permit_test.rb (renamed from actionpack/test/controller/parameters/parameters_taint_test.rb)2
-rw-r--r--actionpack/test/controller/permitted_params_test.rb25
-rw-r--r--actionpack/test/controller/tainted_params_test.rb25
3 files changed, 26 insertions, 26 deletions
diff --git a/actionpack/test/controller/parameters/parameters_taint_test.rb b/actionpack/test/controller/parameters/parameters_permit_test.rb
index 9e8444c897..f143e22d2e 100644
--- a/actionpack/test/controller/parameters/parameters_taint_test.rb
+++ b/actionpack/test/controller/parameters/parameters_permit_test.rb
@@ -1,7 +1,7 @@
require 'abstract_unit'
require 'action_controller/metal/strong_parameters'
-class ParametersTaintTest < ActiveSupport::TestCase
+class ParametersPermitTest < ActiveSupport::TestCase
setup do
@params = ActionController::Parameters.new({ person: {
age: "32", name: { first: "David", last: "Heinemeier Hansson" }
diff --git a/actionpack/test/controller/permitted_params_test.rb b/actionpack/test/controller/permitted_params_test.rb
new file mode 100644
index 0000000000..f46249d712
--- /dev/null
+++ b/actionpack/test/controller/permitted_params_test.rb
@@ -0,0 +1,25 @@
+require 'abstract_unit'
+
+class PeopleController < ActionController::Base
+ def create
+ render text: params[:person].permitted? ? "permitted" : "forbidden"
+ end
+
+ def create_with_permit
+ render text: params[:person].permit(:name).permitted? ? "permitted" : "forbidden"
+ end
+end
+
+class ActionControllerPermittedParamsTest < ActionController::TestCase
+ tests PeopleController
+
+ test "parameters are forbidden" do
+ post :create, { person: { name: "Mjallo!" } }
+ assert_equal "forbidden", response.body
+ end
+
+ test "parameters can be permitted and are then not forbidden" do
+ post :create_with_permit, { person: { name: "Mjallo!" } }
+ assert_equal "permitted", response.body
+ end
+end
diff --git a/actionpack/test/controller/tainted_params_test.rb b/actionpack/test/controller/tainted_params_test.rb
deleted file mode 100644
index 881b9d40fa..0000000000
--- a/actionpack/test/controller/tainted_params_test.rb
+++ /dev/null
@@ -1,25 +0,0 @@
-require 'abstract_unit'
-
-class PeopleController < ActionController::Base
- def create
- render text: params[:person].permitted? ? "untainted" : "tainted"
- end
-
- def create_with_permit
- render text: params[:person].permit(:name).permitted? ? "untainted" : "tainted"
- end
-end
-
-class ActionControllerTaintedParamsTest < ActionController::TestCase
- tests PeopleController
-
- test "parameters are tainted" do
- post :create, { person: { name: "Mjallo!" } }
- assert_equal "tainted", response.body
- end
-
- test "parameters can be permitted and are then not tainted" do
- post :create_with_permit, { person: { name: "Mjallo!" } }
- assert_equal "untainted", response.body
- end
-end