aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/hash/transform_values_test.rb
diff options
context:
space:
mode:
Diffstat (limited to 'activesupport/test/core_ext/hash/transform_values_test.rb')
-rw-r--r--activesupport/test/core_ext/hash/transform_values_test.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/hash/transform_values_test.rb b/activesupport/test/core_ext/hash/transform_values_test.rb
new file mode 100644
index 0000000000..e481b5e4a9
--- /dev/null
+++ b/activesupport/test/core_ext/hash/transform_values_test.rb
@@ -0,0 +1,22 @@
+# frozen_string_literal: true
+
+require "abstract_unit"
+require "active_support/core_ext/hash/indifferent_access"
+
+class TransformValuesDeprecatedRequireTest < ActiveSupport::TestCase
+ test "requiring transform_values is deprecated" do
+ assert_deprecated do
+ require "active_support/core_ext/hash/transform_values"
+ end
+ end
+end
+
+class IndifferentTransformValuesTest < ActiveSupport::TestCase
+ test "indifferent access is still indifferent after mapping values" do
+ original = { a: "a", b: "b" }.with_indifferent_access
+ mapped = original.transform_values { |v| v + "!" }
+
+ assert_equal "a!", mapped[:a]
+ assert_equal "a!", mapped["a"]
+ end
+end