summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-04 21:15:34 +0900
committerHiroshi SHIBATA <hsbt@ruby-lang.org>2020-06-05 07:32:42 +0900
commit459eb684b7a90e11ba5812ce9bb518f4940d3519 (patch)
treea94415b44bc793b17d23f03ceaccb9e024589c43
parent4d233d18a2d8ad21513de818f4d089ce46ef484c (diff)
Manually pick from rubygems/rubygems changes at
https://github.com/rubygems/rubygems/pull/3666/commits/ca5bf584026c9fd3a288eb10c65493e9f01ccc44
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/3184
-rw-r--r--spec/bundler/install/gemfile/groups_spec.rb100
1 files changed, 56 insertions, 44 deletions
diff --git a/spec/bundler/install/gemfile/groups_spec.rb b/spec/bundler/install/gemfile/groups_spec.rb
index 8ace6719cb..f222731559 100644
--- a/spec/bundler/install/gemfile/groups_spec.rb
+++ b/spec/bundler/install/gemfile/groups_spec.rb
@@ -86,7 +86,8 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle! :install, forgotten_command_line_options(:without => "emo")
+ bundle "config --local without emo"
+ bundle! :install
expect(the_bundle).to include_gems "rack 1.0.0", :groups => [:default]
end
@@ -100,24 +101,27 @@ RSpec.describe "bundle install with groups" do
end
it "does not install gems from the excluded group" do
- bundle :install, :without => "emo"
+ bundle "config --local without emo"
+ bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5", :groups => [:default]
end
- it "does not install gems from the previously excluded group" do
- bundle :install, forgotten_command_line_options(:without => "emo")
+ it "remembers previous exclusion with `--without`", :bundler => "< 3" do
+ bundle "install --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, forgotten_command_line_options(:without => "emo")
+ bundle "config --local without emo"
+ bundle! :install
expect(out).not_to include("activesupport")
end
it "allows Bundler.setup for specific groups" do
- bundle :install, forgotten_command_line_options(:without => "emo")
+ bundle "config --local without emo"
+ bundle :install
run!("require 'rack'; puts RACK", :default)
expect(out).to eq("1.0.0")
end
@@ -131,7 +135,8 @@ RSpec.describe "bundle install with groups" do
end
G
- bundle :install, forgotten_command_line_options(:without => "emo")
+ bundle "config --local without emo"
+ bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.2", :groups => [:default]
end
@@ -147,15 +152,15 @@ RSpec.describe "bundle install with groups" do
ENV["BUNDLE_WITHOUT"] = nil
end
- it "clears --without when passed an empty list" do
- bundle :install, forgotten_command_line_options(:without => "emo")
+ it "clears --without when passed an empty list", :bundler => "< 3" do
+ bundle "install --without emo"
- bundle :install, forgotten_command_line_options(:without => "")
+ bundle "install --without ''"
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
- it "doesn't clear without when nothing is passed" do
- bundle :install, forgotten_command_line_options(:without => "emo")
+ it "doesn't clear without when nothing is passed", :bundler => "< 3" do
+ bundle "install --without emo"
bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
@@ -167,12 +172,13 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems from the optional group when requested" do
- bundle :install, forgotten_command_line_options(:with => "debugging")
+ bundle "config --local with debugging"
+ bundle :install
expect(the_bundle).to include_gems "thin 1.0"
end
- it "installs gems from the previously requested group" do
- bundle :install, forgotten_command_line_options(:with => "debugging")
+ it "installs gems from the previously requested group", :bundler => "< 3" do
+ bundle "install --with debugging"
expect(the_bundle).to include_gems "thin 1.0"
bundle :install
expect(the_bundle).to include_gems "thin 1.0"
@@ -185,26 +191,26 @@ RSpec.describe "bundle install with groups" do
ENV["BUNDLE_WITH"] = nil
end
- it "clears --with when passed an empty list" do
- bundle :install, forgotten_command_line_options(:with => "debugging")
- bundle :install, forgotten_command_line_options(:with => "")
+ it "clears --with when passed an empty list", :bundler => "< 3" do
+ bundle "install --with debugging"
+ bundle "install --with ''"
expect(the_bundle).not_to include_gems "thin 1.0"
end
it "removes groups from without when passed at --with", :bundler => "< 3" do
- bundle :install, forgotten_command_line_options(:without => "emo")
- bundle :install, forgotten_command_line_options(:with => "emo")
+ bundle "config --local without emo"
+ bundle "install --with emo"
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "removes groups from with when passed at --without", :bundler => "< 3" do
- bundle :install, forgotten_command_line_options(:with => "debugging")
- bundle :install, forgotten_command_line_options(:without => "debugging")
+ bundle "config --local with debugging"
+ bundle "install --without debugging"
expect(the_bundle).not_to include_gem "thin 1.0"
end
it "errors out when passing a group to with and without via CLI flags", :bundler => "< 3" do
- bundle :install, forgotten_command_line_options(:with => "emo debugging", :without => "emo")
+ bundle "install --with emo debugging --without emo"
expect(last_command).to be_failure
expect(err).to include("The offending groups are: emo")
end
@@ -222,19 +228,21 @@ RSpec.describe "bundle install with groups" do
expect(the_bundle).to include_gem "thin 1.0"
end
- it "can add and remove a group at the same time" do
- bundle :install, forgotten_command_line_options(:with => "debugging", :without => "emo")
+ it "can add and remove a group at the same time", :bundler => "< 3" do
+ bundle "install --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 "has no effect when listing a not optional group in with" do
- bundle :install, forgotten_command_line_options(:with => "emo")
+ bundle "config --local with emo"
+ bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5"
end
it "has no effect when listing an optional group in without" do
- bundle :install, forgotten_command_line_options(:without => "debugging")
+ bundle "config --local without debugging"
+ bundle :install
expect(the_bundle).not_to include_gems "thin 1.0"
end
end
@@ -251,12 +259,14 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle! :install, forgotten_command_line_options(:without => "emo lolercoaster")
+ bundle "config --local without emo lolercoaster"
+ bundle! :install
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, forgotten_command_line_options(:without => "emo")
+ bundle "config --local without emo"
+ bundle! :install
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end
@@ -276,23 +286,21 @@ RSpec.describe "bundle install with groups" do
G
end
- it "installs the gem w/ option --without emo" do
- bundle :install, forgotten_command_line_options(:without => "emo")
+ it "installs the gem unless all groups are excluded" do
+ bundle "config --local without emo"
+ bundle :install
expect(the_bundle).to include_gems "activesupport 2.3.5"
- end
- it "installs the gem w/ option --without lolercoaster" do
- bundle :install, forgotten_command_line_options(:without => "lolercoaster")
+ bundle "config --local without lolercoaster"
+ bundle :install
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, forgotten_command_line_options(:without => "emo lolercoaster")
+ bundle "config --local without emo lolercoaster"
+ bundle :install
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, forgotten_command_line_options(:without => "'emo lolercoaster'")
+ bundle "config --local without 'emo lolercoaster'"
+ bundle :install
expect(the_bundle).not_to include_gems "activesupport 2.3.5"
end
end
@@ -312,12 +320,14 @@ RSpec.describe "bundle install with groups" do
end
it "installs gems in the default group" do
- bundle! :install, forgotten_command_line_options(:without => "emo lolercoaster")
+ bundle "config --local without emo lolercoaster"
+ bundle! :install
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, forgotten_command_line_options(:without => "emo")
+ bundle "config --local without emo"
+ bundle! :install
expect(the_bundle).to include_gems "rack 1.0.0", "activesupport 2.3.5"
end
end
@@ -354,7 +364,8 @@ RSpec.describe "bundle install with groups" do
system_gems "rack-0.9.1"
- install_gemfile <<-G, forgotten_command_line_options(:without => "rack")
+ bundle "config --local without rack"
+ install_gemfile <<-G
source "#{file_uri_for(gem_repo2)}"
gem "rack"
@@ -377,7 +388,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, forgotten_command_line_options(:without => "rack").merge(:verbose => true)
+ bundle "config --local without rack"
+ bundle! :install, :verbose => true
expect(last_command.stdboth).not_to match(/fetching/i)
end
end