diff options
Diffstat (limited to 'activemodel/test/cases/forbidden_attributes_protection_test.rb')
-rw-r--r-- | activemodel/test/cases/forbidden_attributes_protection_test.rb | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/activemodel/test/cases/forbidden_attributes_protection_test.rb b/activemodel/test/cases/forbidden_attributes_protection_test.rb index d8d757f52a..0fd0a2f8ee 100644 --- a/activemodel/test/cases/forbidden_attributes_protection_test.rb +++ b/activemodel/test/cases/forbidden_attributes_protection_test.rb @@ -1,6 +1,8 @@ -require 'cases/helper' -require 'active_support/core_ext/hash/indifferent_access' -require 'models/account' +# frozen_string_literal: true + +require "cases/helper" +require "active_support/core_ext/hash/indifferent_access" +require "models/account" class ProtectedParams attr_accessor :permitted @@ -25,18 +27,18 @@ end class ActiveModelMassUpdateProtectionTest < ActiveSupport::TestCase test "forbidden attributes cannot be used for mass updating" do - params = ProtectedParams.new({ "a" => "b" }) + params = ProtectedParams.new("a" => "b") assert_raises(ActiveModel::ForbiddenAttributesError) do Account.new.sanitize_for_mass_assignment(params) end end test "permitted attributes can be used for mass updating" do - params = ProtectedParams.new({ "a" => "b" }).permit! + params = ProtectedParams.new("a" => "b").permit! assert_equal({ "a" => "b" }, Account.new.sanitize_for_mass_assignment(params)) end test "regular attributes should still be allowed" do - assert_equal({ a: "b" }, Account.new.sanitize_for_mass_assignment(a: "b")) + assert_equal({ a: "b" }, Account.new.sanitize_for_mass_assignment(a: "b")) end end |