summaryrefslogtreecommitdiff
path: root/spec/bundler/plugin_spec.rb
diff options
context:
space:
mode:
authorfotanus <fotanus@gmail.com>2017-05-24 16:31:30 -0300
committerfotanus <fotanus@gmail.com>2017-05-30 14:27:29 -0300
commita08d08eb9854435ba6d5ef513d95e295ab19e8a6 (patch)
tree97911883bb2772c270f0057d3a287188e0a541e7 /spec/bundler/plugin_spec.rb
parentbf26b5515926c51008f2fe9e9d0054260d482e74 (diff)
downloadbundler-a08d08eb9854435ba6d5ef513d95e295ab19e8a6.tar.gz
implement command `bundle plugin list`
Diffstat (limited to 'spec/bundler/plugin_spec.rb')
-rw-r--r--spec/bundler/plugin_spec.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/spec/bundler/plugin_spec.rb b/spec/bundler/plugin_spec.rb
index 9796b580a3..40e71ab578 100644
--- a/spec/bundler/plugin_spec.rb
+++ b/spec/bundler/plugin_spec.rb
@@ -32,6 +32,31 @@ RSpec.describe Bundler::Plugin do
allow(index).to receive(:register_plugin)
end
+ describe "list command" do
+ let(:opts) { { "version" => "~> 1.0", "source" => "foo" } }
+
+ context "when no plugins are installed" do
+ before { allow(index).to receive(:installed_plugins) { [] } }
+ it "outputs no plugins installed" do
+ expect(Bundler.ui).to receive(:info).with("No plugins installed")
+ subject.list
+ end
+ end
+
+ context "with installed plugins" do
+ before do
+ allow(index).to receive(:installed_plugins) { %w[plug1 plug2] }
+ allow(index).to receive(:plugin_commands).with("plug1") { %w[c11 c12] }
+ allow(index).to receive(:plugin_commands).with("plug2") { %w[c21 c22] }
+ end
+ it "list plugins followed by commands" do
+ expected_output = "plug1\n-----\n c11\n c12\n\nplug2\n-----\n c21\n c22\n\n"
+ expect(Bundler.ui).to receive(:info).with(expected_output)
+ subject.list
+ end
+ end
+ end
+
describe "install command" do
let(:opts) { { "version" => "~> 1.0", "source" => "foo" } }