aboutsummaryrefslogtreecommitdiffstats
path: root/activesupport/test/core_ext/marshal_test.rb
diff options
context:
space:
mode:
authorJeff Latz <jeff@pumpone.com>2017-02-14 14:47:30 -0500
committerJeff Latz <jeff@pumpone.com>2017-02-24 12:12:07 -0500
commita72498f776b2e67b7e3a074423181defcd06fc56 (patch)
tree0b4e055ad1ae86650cca1e51863016ae6dbd291d /activesupport/test/core_ext/marshal_test.rb
parent87b2b6c5124732ff709b8e1900a99ba0a08f6982 (diff)
downloadrails-a72498f776b2e67b7e3a074423181defcd06fc56.tar.gz
rails-a72498f776b2e67b7e3a074423181defcd06fc56.tar.bz2
rails-a72498f776b2e67b7e3a074423181defcd06fc56.zip
add optional second argument to ActiveSupport core extension for Marshal#load so it can take a proc
Diffstat (limited to 'activesupport/test/core_ext/marshal_test.rb')
-rw-r--r--activesupport/test/core_ext/marshal_test.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/activesupport/test/core_ext/marshal_test.rb b/activesupport/test/core_ext/marshal_test.rb
index a899f98705..cabeed2fae 100644
--- a/activesupport/test/core_ext/marshal_test.rb
+++ b/activesupport/test/core_ext/marshal_test.rb
@@ -19,6 +19,19 @@ class MarshalTest < ActiveSupport::TestCase
end
end
+ test "that Marshal#load still works when passed a proc" do
+ example_string = "test"
+
+ example_proc = Proc.new do |o|
+ if o.is_a?(String)
+ o.capitalize!
+ end
+ end
+
+ dumped = Marshal.dump(example_string)
+ assert_equal Marshal.load(dumped, example_proc), "Test"
+ end
+
test "that a missing class is autoloaded from string" do
dumped = nil
with_autoloading_fixtures do