From a5faf6fb7279ebd1fab92d51bcc705469b7b98d9 Mon Sep 17 00:00:00 2001 From: Brian Abreu Date: Tue, 28 Jun 2016 18:32:49 -0700 Subject: Correctly handle frozen options for ActiveRecord::Serialization#serializable_hash. --- activerecord/test/cases/json_serialization_test.rb | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) (limited to 'activerecord/test/cases/json_serialization_test.rb') diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb index a2150483f3..f8120d582b 100644 --- a/activerecord/test/cases/json_serialization_test.rb +++ b/activerecord/test/cases/json_serialization_test.rb @@ -149,10 +149,8 @@ class JsonSerializationTest < ActiveRecord::TestCase end def test_serializable_hash_should_not_modify_options_in_argument - options = { only: :name } - @contact.serializable_hash(options) - - assert_nil options[:except] + options = { only: :name }.freeze + assert_nothing_raised { @contact.serializable_hash(options) } end end -- cgit v1.2.3 From 831be98f9a6685da3410b0c9bf4143bd8dd647af Mon Sep 17 00:00:00 2001 From: Kir Shatrov Date: Sun, 9 Jul 2017 20:41:28 +0300 Subject: Use frozen-string-literal in ActiveRecord --- activerecord/test/cases/json_serialization_test.rb | 2 ++ 1 file changed, 2 insertions(+) (limited to 'activerecord/test/cases/json_serialization_test.rb') diff --git a/activerecord/test/cases/json_serialization_test.rb b/activerecord/test/cases/json_serialization_test.rb index a6ea27bf48..52fe488cd5 100644 --- a/activerecord/test/cases/json_serialization_test.rb +++ b/activerecord/test/cases/json_serialization_test.rb @@ -1,3 +1,5 @@ +# frozen_string_literal: true + require "cases/helper" require "models/contact" require "models/post" -- cgit v1.2.3