diff options
author | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-12-20 09:43:53 +0900 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2022-12-20 13:15:02 +0900 |
commit | 18ba89093a0b214cd89f1567c037c239f094496d (patch) | |
tree | bb4e07c66cca5fd2da04da297e8c66fbf883fdad /spec/bundler/commands | |
parent | ad1f61fe80dea7a1b1e8d27a4232d7b10b820960 (diff) |
Merge RubyGems/Bundler master
Pick from https://github.com/rubygems/rubygems/commit/ba3adad4d80038ffd7bea015da2f11d3e8a2ff82
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/6966
Diffstat (limited to 'spec/bundler/commands')
-rw-r--r-- | spec/bundler/commands/newgem_spec.rb | 50 | ||||
-rw-r--r-- | spec/bundler/commands/update_spec.rb | 62 |
2 files changed, 92 insertions, 20 deletions
diff --git a/spec/bundler/commands/newgem_spec.rb b/spec/bundler/commands/newgem_spec.rb index c4e8b3a6e7..15a75577a1 100644 --- a/spec/bundler/commands/newgem_spec.rb +++ b/spec/bundler/commands/newgem_spec.rb @@ -348,7 +348,6 @@ RSpec.describe "bundle gem" do shared_examples_for "CI config is absent" do it "does not create any CI files" do expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to_not exist - expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to_not exist expect(bundled_app("#{gem_name}/.circleci/config.yml")).to_not exist end @@ -888,12 +887,29 @@ RSpec.describe "bundle gem" do bundle "gem #{gem_name}" expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to_not exist - expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to_not exist expect(bundled_app("#{gem_name}/.circleci/config.yml")).to_not exist end end + context "--ci set to travis" do + it "generates a GitHub Actions config file" do + bundle "gem #{gem_name} --ci=travis", :raise_on_error => false + expect(err).to include("Support for Travis CI was removed from gem skeleton generator.") + + expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist + end + end + + context "--ci set to travis" do + it "generates a GitHub Actions config file" do + bundle "gem #{gem_name} --ci=travis", :raise_on_error => false + expect(err).to include("Support for Travis CI was removed from gem skeleton generator.") + + expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist + end + end + context "--ci set to github" do it "generates a GitHub Actions config file" do bundle "gem #{gem_name} --ci=github" @@ -918,38 +934,32 @@ RSpec.describe "bundle gem" do end end - context "--ci set to travis" do - it "generates a Travis CI config file" do - bundle "gem #{gem_name} --ci=travis" - - expect(bundled_app("#{gem_name}/.travis.yml")).to exist - end - end - context "gem.ci setting set to none" do it "doesn't generate any CI config" do expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to_not exist - expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist expect(bundled_app("#{gem_name}/.gitlab-ci.yml")).to_not exist expect(bundled_app("#{gem_name}/.circleci/config.yml")).to_not exist end end - context "gem.ci setting set to github" do - it "generates a GitHub Actions config file" do - bundle "config set gem.ci github" - bundle "gem #{gem_name}" + context "gem.ci setting set to travis" do + it "errors with friendly message" do + bundle "config set gem.ci travis" + bundle "gem #{gem_name}", :raise_on_error => false - expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to exist + expect(err).to include("Support for Travis CI was removed from gem skeleton generator,") + expect(err).to include("bundle config unset gem.ci") + + expect(bundled_app("#{gem_name}/.travis.yml")).to_not exist end end - context "gem.ci setting set to travis" do - it "generates a Travis CI config file" do - bundle "config set gem.ci travis" + context "gem.ci setting set to github" do + it "generates a GitHub Actions config file" do + bundle "config set gem.ci github" bundle "gem #{gem_name}" - expect(bundled_app("#{gem_name}/.travis.yml")).to exist + expect(bundled_app("#{gem_name}/.github/workflows/main.yml")).to exist end end diff --git a/spec/bundler/commands/update_spec.rb b/spec/bundler/commands/update_spec.rb index 2d9da70617..583e2aa41b 100644 --- a/spec/bundler/commands/update_spec.rb +++ b/spec/bundler/commands/update_spec.rb @@ -361,6 +361,68 @@ RSpec.describe "bundle update" do expect(out).to include("Installing quickbooks-ruby 1.0.19").and include("Installing oauth2 1.4.10") end + it "does not downgrade direct dependencies when using gemspec sources" do + create_file("rails.gemspec", <<-G) + Gem::Specification.new do |gem| + gem.name = "rails" + gem.version = "7.1.0.alpha" + gem.author = "DHH" + gem.summary = "Full-stack web application framework." + end + G + + build_repo4 do + build_gem "rake", "12.3.3" + build_gem "rake", "13.0.6" + + build_gem "sneakers", "2.11.0" do |s| + s.add_dependency "rake" + end + + build_gem "sneakers", "2.12.0" do |s| + s.add_dependency "rake", "~> 12.3" + end + end + + gemfile <<-G + source "#{file_uri_for(gem_repo4)}" + + gemspec + + gem "rake" + gem "sneakers" + G + + lockfile <<~L + PATH + remote: . + specs: + + GEM + remote: #{file_uri_for(gem_repo4)}/ + specs: + rake (13.0.6) + sneakers (2.11.0) + rake + + PLATFORMS + #{lockfile_platforms} + + DEPENDENCIES + rake + sneakers + + BUNDLED WITH + #{Bundler::VERSION} + L + + bundle "update --verbose" + + expect(out).not_to include("Installing sneakers 2.12.0") + expect(out).not_to include("Installing rake 12.3.3") + expect(out).to include("Installing sneakers 2.11.0").and include("Installing rake 13.0.6") + end + it "does not downgrade indirect dependencies unnecessarily" do build_repo4 do build_gem "a" do |s| |