From f934096638ec5850b65e45dc7230900107441288 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?David=20Rodr=C3=ADguez?= Date: Thu, 19 Aug 2021 11:57:16 +0200 Subject: [rubygems/rubygems] Make plugin installation idempotent The error had not be caught be specs because `bundle install` was returning a zero exit code when plugin installation errors happened. So I fixed that issue too. https://github.com/rubygems/rubygems/commit/90cde87856 --- spec/bundler/bundler/plugin_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'spec/bundler/bundler') diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb index d1a05bbad7..8a1a6cd97a 100644 --- a/spec/bundler/bundler/plugin_spec.rb +++ b/spec/bundler/bundler/plugin_spec.rb @@ -65,6 +65,8 @@ RSpec.describe Bundler::Plugin do end it "passes the name and options to installer" do + allow(index).to receive(:installed?). + with("new-plugin") allow(installer).to receive(:install).with(["new-plugin"], opts) do { "new-plugin" => spec } end.once @@ -73,6 +75,8 @@ RSpec.describe Bundler::Plugin do end it "validates the installed plugin" do + allow(index).to receive(:installed?). + with("new-plugin") allow(subject). to receive(:validate_plugin!).with(lib_path("new-plugin")).once @@ -80,6 +84,8 @@ RSpec.describe Bundler::Plugin do end it "registers the plugin with index" do + allow(index).to receive(:installed?). + with("new-plugin") allow(index).to receive(:register_plugin). with("new-plugin", lib_path("new-plugin").to_s, [lib_path("new-plugin").join("lib").to_s], []).once subject.install ["new-plugin"], opts @@ -96,6 +102,7 @@ RSpec.describe Bundler::Plugin do end.once allow(subject).to receive(:validate_plugin!).twice + allow(index).to receive(:installed?).twice allow(index).to receive(:register_plugin).twice subject.install ["new-plugin", "another-plugin"], opts end -- cgit v1.2.3