1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

[rubygems/rubygems] test loading bad plugins with nil/empty names

https://github.com/rubygems/rubygems/commit/e64b1f3497
This commit is contained in:
Andre Arko 2021-07-13 02:25:09 -07:00 committed by Hiroshi SHIBATA
parent 5cce96891e
commit a3d2200b2a
No known key found for this signature in database
GPG key ID: F9CF13417264FAC2
2 changed files with 3 additions and 1 deletions

View file

@ -309,6 +309,8 @@ module Bundler
# #
# @param [String] name of the plugin # @param [String] name of the plugin
def load_plugin(name) def load_plugin(name)
return unless name && !name.empty?
# Need to ensure before this that plugin root where the rest of gems # Need to ensure before this that plugin root where the rest of gems
# are installed to be on load path to support plugin deps. Currently not # are installed to be on load path to support plugin deps. Currently not
# done to avoid conflicts # done to avoid conflicts

View file

@ -277,7 +277,7 @@ RSpec.describe Bundler::Plugin do
Bundler::Plugin::Events.send(:define, :EVENT_2, "event-2") Bundler::Plugin::Events.send(:define, :EVENT_2, "event-2")
allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_1). allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_1).
and_return(["foo-plugin"]) and_return(["foo-plugin", "", nil])
allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_2). allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_2).
and_return(["foo-plugin"]) and_return(["foo-plugin"])
allow(index).to receive(:plugin_path).with("foo-plugin").and_return(path) allow(index).to receive(:plugin_path).with("foo-plugin").and_return(path)