summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/bundler.rb12
-rw-r--r--spec/bundler/bundler/bundler_spec.rb4
2 files changed, 8 insertions, 8 deletions
diff --git a/lib/bundler.rb b/lib/bundler.rb
index 68fcff7840..1598397bca 100644
--- a/lib/bundler.rb
+++ b/lib/bundler.rb
@@ -525,12 +525,6 @@ EOF
load_marshal(data, :marshal_proc => SAFE_MARSHAL_PROC)
end
- def load_marshal(data, marshal_proc: nil)
- Marshal.load(data, marshal_proc)
- rescue TypeError => e
- raise MarshalError, "#{e.class}: #{e.message}"
- end
-
def load_gemspec(file, validate = false)
@gemspec_cache ||= {}
key = File.expand_path(file)
@@ -619,6 +613,12 @@ EOF
private
+ def load_marshal(data, marshal_proc: nil)
+ Marshal.load(data, marshal_proc)
+ rescue TypeError => e
+ raise MarshalError, "#{e.class}: #{e.message}"
+ end
+
def eval_yaml_gemspec(path, contents)
Kernel.require "psych"
diff --git a/spec/bundler/bundler/bundler_spec.rb b/spec/bundler/bundler/bundler_spec.rb
index 5894b4aa12..e0901c36ff 100644
--- a/spec/bundler/bundler/bundler_spec.rb
+++ b/spec/bundler/bundler/bundler_spec.rb
@@ -5,9 +5,9 @@ require "tmpdir"
RSpec.describe Bundler do
describe "#load_marshal" do
- it "loads any data" do
+ it "is a private method and raises an error" do
data = Marshal.dump(Bundler)
- expect(Bundler.load_marshal(data)).to eq(Bundler)
+ expect { Bundler.load_marshal(data) }.to raise_error(NoMethodError, /private method `load_marshal' called/)
end
end