summaryrefslogtreecommitdiff
path: root/spec/bundler/commands
diff options
context:
space:
mode:
authorHiroshi SHIBATA <hsbt@ruby-lang.org>2021-08-02 12:05:18 +0900
committernagachika <nagachika@ruby-lang.org>2021-08-19 15:46:40 +0900
commitf1039afa4179f9d3a42f0d89b499e3c955b495d9 (patch)
tree6fb8b5fdbaaca16de553f40645fed69c13720908 /spec/bundler/commands
parent4469c4e4beadbe568c5958798afa3316bf292a12 (diff)
Merge RubyGems 3.2.23 and Bundler 2.2.23
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r--spec/bundler/commands/exec_spec.rb10
-rw-r--r--spec/bundler/commands/install_spec.rb96
2 files changed, 67 insertions, 39 deletions
diff --git a/spec/bundler/commands/exec_spec.rb b/spec/bundler/commands/exec_spec.rb
index 0d104ad304..39430d52a4 100644
--- a/spec/bundler/commands/exec_spec.rb
+++ b/spec/bundler/commands/exec_spec.rb
@@ -24,6 +24,16 @@ RSpec.describe "bundle exec" do
expect(out).to eq("0.9.1")
end
+ it "works and prints no warnings when HOME is not writable" do
+ gemfile <<-G
+ gem "rack", "0.9.1"
+ G
+
+ bundle "exec rackup", :env => { "HOME" => "/" }
+ expect(out).to eq("0.9.1")
+ expect(err).to be_empty
+ end
+
it "works when the bins are in ~/.bundle" do
install_gemfile <<-G
gem "rack"
diff --git a/spec/bundler/commands/install_spec.rb b/spec/bundler/commands/install_spec.rb
index c91864dbb8..3c0c35d844 100644
--- a/spec/bundler/commands/install_spec.rb
+++ b/spec/bundler/commands/install_spec.rb
@@ -344,54 +344,72 @@ RSpec.describe "bundle install with gem sources" do
expect(File.exist?(bundled_app_lock)).to eq(true)
end
- context "throws a warning if a gem is added twice in Gemfile" do
- it "without version requirements" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo2)}"
- gem "rack"
- gem "rack"
- G
+ it "throws a warning if a gem is added twice in Gemfile without version requirements" do
+ install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo2)}"
+ gem "rack"
+ gem "rack"
+ G
- expect(err).to include("Your Gemfile lists the gem rack (>= 0) more than once.")
- expect(err).to include("Remove any duplicate entries and specify the gem only once.")
- expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
- end
+ expect(err).to include("Your Gemfile lists the gem rack (>= 0) more than once.")
+ expect(err).to include("Remove any duplicate entries and specify the gem only once.")
+ expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
+ end
- it "with same versions" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo2)}"
- gem "rack", "1.0"
- gem "rack", "1.0"
- G
+ it "throws a warning if a gem is added twice in Gemfile with same versions" do
+ install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo2)}"
+ gem "rack", "1.0"
+ gem "rack", "1.0"
+ G
- expect(err).to include("Your Gemfile lists the gem rack (= 1.0) more than once.")
- expect(err).to include("Remove any duplicate entries and specify the gem only once.")
- expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
- end
+ expect(err).to include("Your Gemfile lists the gem rack (= 1.0) more than once.")
+ expect(err).to include("Remove any duplicate entries and specify the gem only once.")
+ expect(err).to include("While it's not a problem now, it could cause errors if you change the version of one of them later.")
end
- context "throws an error if a gem is added twice in Gemfile" do
- it "when version of one dependency is not specified" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo2)}"
- gem "rack"
- gem "rack", "1.0"
- G
+ it "does not throw a warning if a gem is added once in Gemfile and also inside a gemspec as a development dependency" do
+ build_lib "my-gem", :path => bundled_app do |s|
+ s.add_development_dependency "my-private-gem"
+ end
- expect(err).to include("You cannot specify the same gem twice with different version requirements")
- expect(err).to include("You specified: rack (>= 0) and rack (= 1.0).")
+ build_repo2 do
+ build_gem "my-private-gem"
end
- it "when different versions of both dependencies are specified" do
- install_gemfile <<-G, :raise_on_error => false
- source "#{file_uri_for(gem_repo2)}"
- gem "rack", "1.0"
- gem "rack", "1.1"
- G
+ gemfile <<~G
+ source "#{file_uri_for(gem_repo2)}"
- expect(err).to include("You cannot specify the same gem twice with different version requirements")
- expect(err).to include("You specified: rack (= 1.0) and rack (= 1.1).")
- end
+ gemspec
+
+ gem "my-private-gem", :group => :development
+ G
+
+ bundle :install
+
+ expect(err).to be_empty
+ end
+
+ it "throws an error if a gem is added twice in Gemfile when version of one dependency is not specified" do
+ install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo2)}"
+ gem "rack"
+ gem "rack", "1.0"
+ G
+
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).to include("You specified: rack (>= 0) and rack (= 1.0).")
+ end
+
+ it "throws an error if a gem is added twice in Gemfile when different versions of both dependencies are specified" do
+ install_gemfile <<-G, :raise_on_error => false
+ source "#{file_uri_for(gem_repo2)}"
+ gem "rack", "1.0"
+ gem "rack", "1.1"
+ G
+
+ expect(err).to include("You cannot specify the same gem twice with different version requirements")
+ expect(err).to include("You specified: rack (= 1.0) and rack (= 1.1).")
end
it "gracefully handles error when rubygems server is unavailable" do