aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--actionpack/test/controller/parameters/parameters_taint_test.rb6
-rw-r--r--activemodel/test/cases/forbidden_attributes_protection_test.rb10
-rw-r--r--activerecord/test/cases/forbidden_attributes_protection_test.rb16
3 files changed, 10 insertions, 22 deletions
diff --git a/actionpack/test/controller/parameters/parameters_taint_test.rb b/actionpack/test/controller/parameters/parameters_taint_test.rb
index a99a537b37..9e8444c897 100644
--- a/actionpack/test/controller/parameters/parameters_taint_test.rb
+++ b/actionpack/test/controller/parameters/parameters_taint_test.rb
@@ -16,10 +16,8 @@ class ParametersTaintTest < ActiveSupport::TestCase
end
test "fetch doesnt raise ParameterMissing exception if there is a default" do
- assert_nothing_raised do
- assert_equal "monkey", @params.fetch(:foo, "monkey")
- assert_equal "monkey", @params.fetch(:foo) { "monkey" }
- end
+ assert_equal "monkey", @params.fetch(:foo, "monkey")
+ assert_equal "monkey", @params.fetch(:foo) { "monkey" }
end
test "permitted is sticky on accessors" do
diff --git a/activemodel/test/cases/forbidden_attributes_protection_test.rb b/activemodel/test/cases/forbidden_attributes_protection_test.rb
index f6437333b0..3cb204a2c5 100644
--- a/activemodel/test/cases/forbidden_attributes_protection_test.rb
+++ b/activemodel/test/cases/forbidden_attributes_protection_test.rb
@@ -27,16 +27,10 @@ class ActiveModelMassUpdateProtectionTest < ActiveSupport::TestCase
test "permitted attributes can be used for mass updating" do
params = ProtectedParams.new({ "a" => "b" }).permit!
- assert_nothing_raised do
- assert_equal({ "a" => "b" },
- Account.new.sanitize_for_mass_assignment(params))
- end
+ assert_equal({ "a" => "b" }, Account.new.sanitize_for_mass_assignment(params))
end
test "regular attributes should still be allowed" do
- assert_nothing_raised do
- assert_equal({ a: "b" },
- Account.new.sanitize_for_mass_assignment(a: "b"))
- end
+ assert_equal({ a: "b" }, Account.new.sanitize_for_mass_assignment(a: "b"))
end
end
diff --git a/activerecord/test/cases/forbidden_attributes_protection_test.rb b/activerecord/test/cases/forbidden_attributes_protection_test.rb
index 89e9de261a..4706eaec2b 100644
--- a/activerecord/test/cases/forbidden_attributes_protection_test.rb
+++ b/activerecord/test/cases/forbidden_attributes_protection_test.rb
@@ -34,21 +34,17 @@ class ForbiddenAttributesProtectionTest < ActiveRecord::TestCase
def test_permitted_attributes_can_be_used_for_mass_assignment
params = ProtectedParams.new(first_name: 'Guille', gender: 'm')
params.permit!
- assert_nothing_raised do
- person = Person.new(params)
+ person = Person.new(params)
- assert_equal 'Guille', person.first_name
- assert_equal 'm', person.gender
- end
+ assert_equal 'Guille', person.first_name
+ assert_equal 'm', person.gender
end
def test_regular_hash_should_still_be_used_for_mass_assignment
- assert_nothing_raised do
- person = Person.new(first_name: 'Guille', gender: 'm')
+ person = Person.new(first_name: 'Guille', gender: 'm')
- assert_equal 'Guille', person.first_name
- assert_equal 'm', person.gender
- end
+ assert_equal 'Guille', person.first_name
+ assert_equal 'm', person.gender
end
def test_protected_attributes_cannot_be_used_for_mass_assignment