summaryrefslogtreecommitdiff
path: root/spec
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-08-02 12:06:43 +0900
committernagachika <nagachika@ruby-lang.org>2021-08-19 15:46:40 +0900
commit679185d6c87e0f2e4f6a5da5ce50d02c80ab31b1 (patch)
tree293fa8c1f863aeb2f711310dc4941528fa829401 /spec
parentf1039afa4179f9d3a42f0d89b499e3c955b495d9 (diff)
Merge RubyGems 3.2.24 and Bundler 2.2.24
Diffstat (limited to 'spec')
-rw-r--r--spec/bundler/bundler/plugin/index_spec.rb8
-rw-r--r--spec/bundler/bundler/plugin_spec.rb2
-rw-r--r--spec/bundler/commands/check_spec.rb28
-rw-r--r--spec/bundler/commands/install_spec.rb1
-rw-r--r--spec/bundler/commands/newgem_spec.rb10
-rw-r--r--spec/bundler/plugins/install_spec.rb6
-rw-r--r--spec/bundler/runtime/setup_spec.rb19
7 files changed, 67 insertions, 7 deletions
diff --git a/spec/bundler/bundler/plugin/index_spec.rb b/spec/bundler/bundler/plugin/index_spec.rb
index e7bde66879..bf32c3e2ba 100644
--- a/spec/bundler/bundler/plugin/index_spec.rb
+++ b/spec/bundler/bundler/plugin/index_spec.rb
@@ -98,7 +98,13 @@ RSpec.describe Bundler::Plugin::Index do
expect(index.hook_plugins("after-bar")).to eq([plugin_name])
end
- context "that are not registered", :focused do
+ it "is gone after unregistration" do
+ expect(index.index_file.read).to include("after-bar:\n - \"new-plugin\"\n")
+ index.unregister_plugin(plugin_name)
+ expect(index.index_file.read).to_not include("after-bar:\n - \n")
+ end
+
+ context "that are not registered" do
let(:file) { double("index-file") }
before do
diff --git a/spec/bundler/bundler/plugin_spec.rb b/spec/bundler/bundler/plugin_spec.rb
index d18896895e..b75a9fa1b2 100644
--- a/spec/bundler/bundler/plugin_spec.rb
+++ b/spec/bundler/bundler/plugin_spec.rb
@@ -279,7 +279,7 @@ RSpec.describe Bundler::Plugin do
Bundler::Plugin::Events.send(:define, :EVENT_2, "event-2")
allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_1).
- and_return(["foo-plugin"])
+ and_return(["foo-plugin", "", nil])
allow(index).to receive(:hook_plugins).with(Bundler::Plugin::Events::EVENT_2).
and_return(["foo-plugin"])
allow(index).to receive(:plugin_path).with("foo-plugin").and_return(path)
diff --git a/spec/bundler/commands/check_spec.rb b/spec/bundler/commands/check_spec.rb
index 2860c82a12..88950cef85 100644
--- a/spec/bundler/commands/check_spec.rb
+++ b/spec/bundler/commands/check_spec.rb
@@ -288,6 +288,34 @@ RSpec.describe "bundle check" do
end
end
+ describe "when locked with multiple dependents with different requirements" do
+ before :each do
+ build_repo4 do
+ build_gem "depends_on_rack" do |s|
+ s.add_dependency "rack", ">= 1.0"
+ end
+ build_gem "also_depends_on_rack" do |s|
+ s.add_dependency "rack", "~> 1.0"
+ end
+ build_gem "rack"
+ end
+
+ gemfile <<-G
+ source "#{file_uri_for(gem_repo4)}"
+ gem "depends_on_rack"
+ gem "also_depends_on_rack"
+ G
+
+ bundle "lock"
+ end
+
+ it "shows what is missing with the current Gemfile without duplications" do
+ bundle :check, :raise_on_error => false
+ expect(err).to match(/The following gems are missing/)
+ expect(err).to include("* rack (1.0").once
+ end
+ end
+
describe "when using only scoped rubygems sources" do
before do
gemfile <<~G
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index 3c0c35d844..00a277a826 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -388,6 +388,7 @@ RSpec.describe "bundle install with gem sources" do
bundle :install
expect(err).to be_empty
+ expect(the_bundle).to include_gems("my-private-gem 1.0")
end
it "throws an error if a gem is added twice in Gemfile when version of one dependency is not specified" do
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb
index 57932fb013..5cdb3ed5e3 100644
--- a/spec/bundler/commands/newgem_spec.rb
+++ b/spec/bundler/commands/newgem_spec.rb
@@ -201,35 +201,35 @@ RSpec.describe "bundle gem" do
skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core?
bundle "gem #{gem_name} --rubocop"
bundle_exec_rubocop
- expect(err).to be_empty
+ expect(last_command).to be_success
end
it "has no rubocop offenses when using --ext and --rubocop flag", :readline do
skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core?
bundle "gem #{gem_name} --ext --rubocop"
bundle_exec_rubocop
- expect(err).to be_empty
+ expect(last_command).to be_success
end
it "has no rubocop offenses when using --ext, --test=minitest, and --rubocop flag", :readline do
skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core?
bundle "gem #{gem_name} --ext --test=minitest --rubocop"
bundle_exec_rubocop
- expect(err).to be_empty
+ expect(last_command).to be_success
end
it "has no rubocop offenses when using --ext, --test=rspec, and --rubocop flag", :readline do
skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core?
bundle "gem #{gem_name} --ext --test=rspec --rubocop"
bundle_exec_rubocop
- expect(err).to be_empty
+ expect(last_command).to be_success
end
it "has no rubocop offenses when using --ext, --ext=test-unit, and --rubocop flag", :readline do
skip "ruby_core has an 'ast.rb' file that gets in the middle and breaks this spec" if ruby_core?
bundle "gem #{gem_name} --ext --test=test-unit --rubocop"
bundle_exec_rubocop
- expect(err).to be_empty
+ expect(last_command).to be_success
end
shared_examples_for "CI config is absent" do
diff --git a/spec/bundler/plugins/install_spec.rb b/spec/bundler/plugins/install_spec.rb
index 2175610b10..ef39e75a58 100644
--- a/spec/bundler/plugins/install_spec.rb
+++ b/spec/bundler/plugins/install_spec.rb
@@ -29,6 +29,12 @@ RSpec.describe "bundler plugin install" do
plugin_should_be_installed("foo")
end
+ it "shows help when --help flag is given" do
+ bundle "plugin install --help"
+
+ expect(out).to include("bundle plugin install PLUGINS # Install the plugin from the source")
+ end
+
context "plugin is already installed" do
before do
bundle "plugin install foo --source #{file_uri_for(gem_repo2)}"
diff --git a/spec/bundler/runtime/setup_spec.rb b/spec/bundler/runtime/setup_spec.rb
index d8ba569f0a..380db99136 100644
--- a/spec/bundler/runtime/setup_spec.rb
+++ b/spec/bundler/runtime/setup_spec.rb
@@ -644,6 +644,25 @@ RSpec.describe "Bundler.setup" do
expect(err).to be_empty
end
+ it "doesn't re-resolve when a pre-release bundler is used and a dependency includes a dependency on bundler" do
+ system_gems "bundler-9.99.9.beta1"
+
+ build_repo4 do
+ build_gem "depends_on_bundler", "1.0" do |s|
+ s.add_dependency "bundler", ">= 1.5.0"
+ end
+ end
+
+ install_gemfile <<~G
+ source "#{file_uri_for(gem_repo4)}"
+ gem "depends_on_bundler"
+ G
+
+ ruby "require '#{system_gem_path("gems/bundler-9.99.9.beta1/lib/bundler.rb")}'; Bundler.setup", :env => { "DEBUG" => "1" }
+ expect(out).to include("Found no changes, using resolution from the lockfile")
+ expect(err).to be_empty
+ end
+
it "remembers --without and does not include groups passed to Bundler.setup" do
bundle "config set --local without rails"
install_gemfile <<-G