diff options
author | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 06:01:35 +0000 |
---|---|---|
committer | hsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2019-04-14 06:01:35 +0000 |
commit | 68ddd4d300e9a88737c4f37af74e1a0312949b2f (patch) | |
tree | 787e1e83d76934ce039eb336995a8d5bb53a89e6 /spec/bundler/commands/list_spec.rb | |
parent | d636809c057432e8d42abe30c6c6785eb0721d77 (diff) |
Merge Bundler 2.1.0.pre.1 as developed version from upstream.
https://github.com/bundler/bundler/commit/a53709556b95a914e874b22ed2116a46b0528852
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67539 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/commands/list_spec.rb')
-rw-r--r-- | spec/bundler/commands/list_spec.rb | 83 |
1 files changed, 60 insertions, 23 deletions
diff --git a/spec/bundler/commands/list_spec.rb b/spec/bundler/commands/list_spec.rb index ba4bb9b040..346b47517e 100644 --- a/spec/bundler/commands/list_spec.rb +++ b/spec/bundler/commands/list_spec.rb @@ -1,20 +1,11 @@ # frozen_string_literal: true -RSpec.describe "bundle list", :bundler => "3" do - before do - install_gemfile <<-G - source "file://#{gem_repo1}" - - gem "rack" - gem "rspec", :group => [:test] - G - end - +RSpec.describe "bundle list" do context "with name-only and paths option" do it "raises an error" do bundle "list --name-only --paths" - expect(out).to eq "The `--name-only` and `--paths` options cannot be used together" + expect(err).to eq "The `--name-only` and `--paths` options cannot be used together" end end @@ -22,11 +13,20 @@ RSpec.describe "bundle list", :bundler => "3" do it "raises an error" do bundle "list --without-group dev --only-group test" - expect(out).to eq "The `--only-group` and `--without-group` options cannot be used together" + expect(err).to eq "The `--only-group` and `--without-group` options cannot be used together" end end describe "with without-group option" do + before do + install_gemfile <<-G + source "file://#{gem_repo1}" + + gem "rack" + gem "rspec", :group => [:test] + G + end + context "when group is present" do it "prints the gems not in the specified group" do bundle! "list --without-group test" @@ -40,12 +40,21 @@ RSpec.describe "bundle list", :bundler => "3" do it "raises an error" do bundle "list --without-group random" - expect(out).to eq "`random` group could not be found." + expect(err).to eq "`random` group could not be found." end end end describe "with only-group option" do + before do + install_gemfile <<-G + source "file://#{gem_repo1}" + + gem "rack" + gem "rspec", :group => [:test] + G + end + context "when group is present" do it "prints the gems in the specified group" do bundle! "list --only-group default" @@ -59,12 +68,21 @@ RSpec.describe "bundle list", :bundler => "3" do it "raises an error" do bundle "list --only-group random" - expect(out).to eq "`random` group could not be found." + expect(err).to eq "`random` group could not be found." end end end context "with name-only option" do + before do + install_gemfile <<-G + source "file://#{gem_repo1}" + + gem "rack" + gem "rspec", :group => [:test] + G + end + it "prints only the name of the gems in the bundle" do bundle "list --name-only" @@ -82,7 +100,6 @@ RSpec.describe "bundle list", :bundler => "3" do build_git "git_test", "1.0.0", :path => lib_path("git_test") build_lib("gemspec_test", :path => tmp.join("gemspec_test")) do |s| - s.write("Gemfile", "source :rubygems\ngemspec") s.add_dependency "bar", "=1.0.0" end @@ -93,8 +110,6 @@ RSpec.describe "bundle list", :bundler => "3" do gem "git_test", :git => "#{lib_path("git_test")}" gemspec :path => "#{tmp.join("gemspec_test")}" G - - bundle! "install" end it "prints the path of each gem in the bundle" do @@ -119,13 +134,35 @@ RSpec.describe "bundle list", :bundler => "3" do end end - it "lists gems installed in the bundle" do - bundle "list" - expect(out).to include(" * rack (1.0.0)") + context "without options" do + before do + install_gemfile <<-G + source "file://#{gem_repo1}" + + gem "rack" + gem "rspec", :group => [:test] + G + end + + it "lists gems installed in the bundle" do + bundle "list" + expect(out).to include(" * rack (1.0.0)") + end end - it "aliases the ls command to list" do - bundle "ls" - expect(out).to include("Gems included by the bundle") + context "when using the ls alias" do + before do + install_gemfile <<-G + source "file://#{gem_repo1}" + + gem "rack" + gem "rspec", :group => [:test] + G + end + + it "runs the list command" do + bundle "ls" + expect(out).to include("Gems included by the bundle") + end end end |