diff options
Diffstat (limited to 'spec')
| -rw-r--r-- | spec/bundler/bundler/plugin_spec.rb | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb index 3ac7b251a3..fea3925000 100644 --- a/spec/bundler/bundler/plugin_spec.rb +++ b/spec/bundler/bundler/plugin_spec.rb @@ -333,5 +333,28 @@ RSpec.describe Bundler::Plugin do end.to output("win\n").to_stdout end end + + context "the plugin load_path is invalid" do + before do + allow(index).to receive(:load_paths).with("foo-plugin"). + and_return(["invalid-file-name1", "invalid-file-name2"]) + end + + it "outputs a useful warning" do + msg = + "The following plugin paths don't exist: invalid-file-name1, invalid-file-name2.\n\n" \ + "This can happen if the plugin was " \ + "installed with a different version of Ruby that has since been uninstalled.\n\n" \ + "If you would like to reinstall the plugin, run:\n\n" \ + "bundler plugin uninstall foo-plugin && bundler plugin install foo-plugin\n\n" \ + "Continuing without installing plugin foo-plugin.\n" + + expect(Bundler.ui).to receive(:warn).with(msg) + + Plugin.hook(Bundler::Plugin::Events::EVENT1) + + expect(subject.loaded?("foo-plugin")).to be_falsey + end + end end end |
