summaryrefslogtreecommitdiff
path: root/spec/bundler/install/gemfile/groups_spec.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-01 23:29:38 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2017-11-01 23:29:38 +0000
commitbe7b5929126cb3e696ef222339237faba9b8fe5a (patch)
tree51eae376f93c09bc82dde5a657a91df2c89062e4 /spec/bundler/install/gemfile/groups_spec.rb
parentae49dbd392083f69026f2a0fff4a1d5f42d172a7 (diff)
Update bundled bundler to 1.16.0.
* lib/bundler, spec/bundler: Merge bundler-1.16.0. * common.mk: rspec examples of bundler-1.16.0 needs require option. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@60603 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'spec/bundler/install/gemfile/groups_spec.rb')
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb91
1 files changed, 52 insertions, 39 deletions
diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb
index a3a5eeefdf..19c379e188 100644
--- a/spec/bundler/install/gemfile/groups_spec.rb
+++ b/spec/bundler/install/gemfile/groups_spec.rb
@@ -1,5 +1,4 @@
# frozen_string_literal: true
-require "spec_helper"
RSpec.describe "bundle install with groups" do
describe "installing with no options" do
@@ -87,7 +86,7 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle :install, :without => "emo"
+ bundle! :install, forgotten_command_line_options(:without => "emo")
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
end
@@ -97,20 +96,20 @@ RSpec.describe "bundle install with groups" do
end
it "does not install gems from the previously excluded group" do
- bundle :install, :without => "emo"
+ bundle :install, forgotten_command_line_options(:without => "emo")
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
end
it "does not say it installed gems from the excluded group" do
- bundle :install, :without => "emo"
+ bundle! :install, forgotten_command_line_options(:without => "emo")
expect(out).not_to include("activesupport")
end
it "allows Bundler.setup for specific groups" do
- bundle :install, :without => "emo"
- run("require 'rack'; puts RACK", :default)
+ bundle :install, forgotten_command_line_options(:without => "emo")
+ run!("require 'rack'; puts RACK", :default)
expect(out).to eq("1.0.0")
end
@@ -123,15 +122,15 @@ RSpec.describe "bundle install with groups" do
end
G
- bundle :install, :without => "emo"
+ bundle :install, forgotten_command_line_options(:without => "emo")
expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => [:default]
end
it "still works on a different machine and excludes gems" do
- bundle :install, :without => "emo"
+ bundle :install, forgotten_command_line_options(:without => "emo")
simulate_new_machine
- bundle :install, :without => "emo"
+ bundle :install, forgotten_command_line_options(:without => "emo")
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default]
@@ -150,14 +149,14 @@ RSpec.describe "bundle install with groups" do
end
it "clears without when passed an empty list" do
- bundle :install, :without => "emo"
+ bundle :install, forgotten_command_line_options(:without => "emo")
- bundle 'install --without ""'
+ bundle :install, forgotten_command_line_options(:without => "")
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "doesn't clear without when nothing is passed" do
- bundle :install, :without => "emo"
+ bundle :install, forgotten_command_line_options(:without => "emo")
bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
@@ -169,12 +168,12 @@ RSpec.describe "bundle install with groups" do
end
it "does install gems from the optional group when requested" do
- bundle :install, :with => "debugging"
+ bundle :install, forgotten_command_line_options(:with => "debugging")
expect(the_bundle).to include_gems "thin 1.0"
end
it "does install gems from the previously requested group" do
- bundle :install, :with => "debugging"
+ bundle :install, forgotten_command_line_options(:with => "debugging")
expect(the_bundle).to include_gems "thin 1.0"
bundle :install
expect(the_bundle).to include_gems "thin 1.0"
@@ -188,41 +187,55 @@ RSpec.describe "bundle install with groups" do
end
it "clears with when passed an empty list" do
- bundle :install, :with => "debugging"
- bundle 'install --with ""'
+ bundle :install, forgotten_command_line_options(:with => "debugging")
+ bundle :install, forgotten_command_line_options(:with => "")
expect(the_bundle).not_to include_gems "thin 1.0"
end
- it "does remove groups from without when passed at with" do
- bundle :install, :without => "emo"
- bundle :install, :with => "emo"
+ it "does remove groups from without when passed at --with", :bundler => "< 2" do
+ bundle :install, forgotten_command_line_options(:without => "emo")
+ bundle :install, forgotten_command_line_options(:with => "emo")
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
- it "does remove groups from with when passed at without" do
- bundle :install, :with => "debugging"
- bundle :install, :without => "debugging"
- expect(the_bundle).not_to include_gems "thin 1.0"
+ it "does remove groups from with when passed at --without", :bundler => "< 2" do
+ bundle :install, forgotten_command_line_options(:with => "debugging")
+ bundle :install, forgotten_command_line_options(:without => "debugging")
+ expect(the_bundle).not_to include_gem "thin 1.0"
end
- it "errors out when passing a group to with and without" do
- bundle :install, :with => "emo debugging", :without => "emo"
+ it "errors out when passing a group to with and without via CLI flags", :bundler => "< 2" do
+ bundle :install, forgotten_command_line_options(:with => "emo debugging", :without => "emo")
+ expect(last_command).to be_failure
expect(out).to include("The offending groups are: emo")
end
+ it "allows the BUNDLE_WITH setting to override BUNDLE_WITHOUT" do
+ ENV["BUNDLE_WITH"] = "debugging"
+
+ bundle! :install
+ expect(the_bundle).to include_gem "thin 1.0"
+
+ ENV["BUNDLE_WITHOUT"] = "debugging"
+ expect(the_bundle).to include_gem "thin 1.0"
+
+ bundle! :install
+ expect(the_bundle).to include_gem "thin 1.0"
+ end
+
it "can add and remove a group at the same time" do
- bundle :install, :with => "debugging", :without => "emo"
+ bundle :install, forgotten_command_line_options(:with => "debugging", :without => "emo")
expect(the_bundle).to include_gems "thin 1.0"
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
end
it "does have no effect when listing a not optional group in with" do
- bundle :install, :with => "emo"
+ bundle :install, forgotten_command_line_options(:with => "emo")
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "does have no effect when listing an optional group in without" do
- bundle :install, :without => "debugging"
+ bundle :install, forgotten_command_line_options(:without => "debugging")
expect(the_bundle).not_to include_gems "thin 1.0"
end
end
@@ -239,12 +252,12 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle :install, :without => "emo lolercoaster"
+ bundle! :install, forgotten_command_line_options(:without => "emo lolercoaster")
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "installs the gem if any of its groups are installed" do
- bundle "install --without emo"
+ bundle! :install, forgotten_command_line_options(:without => "emo")
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end
@@ -265,22 +278,22 @@ RSpec.describe "bundle install with groups" do
end
it "installs the gem w/ option --without emo" do
- bundle "install --without emo"
+ bundle :install, forgotten_command_line_options(:without => "emo")
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "installs the gem w/ option --without lolercoaster" do
- bundle "install --without lolercoaster"
+ bundle :install, forgotten_command_line_options(:without => "lolercoaster")
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "does not install the gem w/ option --without emo lolercoaster" do
- bundle "install --without emo lolercoaster"
+ bundle :install, forgotten_command_line_options(:without => "emo lolercoaster")
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
end
it "does not install the gem w/ option --without 'emo lolercoaster'" do
- bundle "install --without 'emo lolercoaster'"
+ bundle :install, forgotten_command_line_options(:without => "'emo lolercoaster'")
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
end
end
@@ -300,12 +313,12 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle :install, :without => "emo lolercoaster"
+ bundle! :install, forgotten_command_line_options(:without => "emo lolercoaster")
expect(the_bundle).to include_gems "rack 1.0.0"
end
it "installs the gem if any of its groups are installed" do
- bundle "install --without emo"
+ bundle! :install, forgotten_command_line_options(:without => "emo")
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end
end
@@ -340,7 +353,7 @@ RSpec.describe "bundle install with groups" do
before(:each) do
build_repo2
system_gems "rack-0.9.1" do
- install_gemfile <<-G, :without => :rack
+ install_gemfile <<-G, forgotten_command_line_options(:without => "rack")
source "file://#{gem_repo2}"
gem "rack"
@@ -364,8 +377,8 @@ RSpec.describe "bundle install with groups" do
it "does not hit the remote a second time" do
FileUtils.rm_rf gem_repo2
- bundle "install --without rack"
- expect(err).to lack_errors
+ bundle! :install, forgotten_command_line_options(:without => "rack").merge(:verbose => true)
+ expect(last_command.stdboth).not_to match(/fetching/i)
end
end
end