зеркало из https://github.com/github/ruby.git
[rubygems/rubygems] make Bundler.load_marshal private
https://github.com/rubygems/rubygems/commit/4909d071d2
This commit is contained in:
Родитель
d5994eb436
Коммит
583137fe56
|
@ -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"
|
||||
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче