summaryrefslogtreecommitdiff
path: root/spec/commands
diff options
context:
space:
mode:
authorThe Bundler Bot <bot@bundler.io>2017-08-11 14:07:47 +0000
committerThe Bundler Bot <bot@bundler.io>2017-08-11 14:07:47 +0000
commit619dc63a797986e49e19d48ceae3b249fa3d8a5f (patch)
treeb10f82368cb10468ad961c158d03629223153220 /spec/commands
parent14e7da3dbecc26fb92411d64287dac9f22b5e7fc (diff)
parent5d22dbe1d49826cc5f7108d95e6981b1ed15c5d8 (diff)
downloadbundler-619dc63a797986e49e19d48ceae3b249fa3d8a5f.tar.gz
Auto merge of #5920 - bundler:colby/bundler-list, r=segiddins
implement new list command ### What was the end-user problem that led to this PR? We're removing the `bundle show` command (which has been replaced with `bundle info`) but we should probably still have a command to list the gems in the bundle. ### What was your diagnosis of the problem? `bundle show` has been marked as deprecated but a replacement for listing gems does not yet exist ### What is your fix for the problem, implemented in this PR? Add a new `bundle list` (including `ls` alias) that prints the gems in the bundle, this was taken from #4754
Diffstat (limited to 'spec/commands')
-rw-r--r--spec/commands/list_spec.rb40
1 files changed, 40 insertions, 0 deletions
diff --git a/spec/commands/list_spec.rb b/spec/commands/list_spec.rb
new file mode 100644
index 0000000000..0ea70f015c
--- /dev/null
+++ b/spec/commands/list_spec.rb
@@ -0,0 +1,40 @@
+# frozen_string_literal: true
+
+RSpec.describe "bundle list", :bundler => "2" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ gem "rack"
+ G
+ end
+
+ context "with name-only option" do
+ it "prints only the name of the gems in the bundle" do
+ bundle "list --name-only"
+ expect(out).to eq "rack"
+ end
+ end
+
+ context "when no gems are in the gemfile" do
+ before do
+ install_gemfile <<-G
+ source "file://#{gem_repo1}"
+ G
+ end
+
+ it "prints message saying no gems are in the bundle" do
+ bundle "list"
+ expect(out).to include("No gems in the Gemfile")
+ end
+ end
+
+ it "lists gems installed in the bundle" do
+ bundle "list"
+ expect(out).to include(" * rack (1.0.0)")
+ end
+
+ it "aliases the ls command to list" do
+ bundle "ls"
+ expect(out).to include("Gems included by the bundle")
+ end
+end