[rubygems/rubygems] Extract a `build_repo3` helper

https://github.com/rubygems/rubygems/commit/d8cf4aa0cd
This commit is contained in:
David Rodríguez 2024-08-02 21:36:08 +02:00 коммит произвёл git
Родитель 7d97dde2e2
Коммит dc804bd83c
7 изменённых файлов: 32 добавлений и 21 удалений

Просмотреть файл

@ -162,7 +162,7 @@ RSpec.describe "bundle outdated" do
build_gem "vcr", "6.0.0"
end
build_repo gem_repo3 do
build_repo3 do
build_gem "pkg-gem-flowbyte-with-dep", "1.0.0" do |s|
s.add_dependency "oj"
end

Просмотреть файл

@ -409,7 +409,7 @@ RSpec.describe "bundle remove" do
context "with sources" do
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "rspec"
end
end

Просмотреть файл

@ -956,7 +956,7 @@ RSpec.describe "bundle update" do
build_gem "vcr", "6.0.0"
end
build_repo gem_repo3 do
build_repo3 do
build_gem "pkg-gem-flowbyte-with-dep", "1.0.0" do |s|
s.add_dependency "oj"
end

Просмотреть файл

@ -8,7 +8,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
before do
# Oh no! Someone evil is trying to hijack myrack :(
# need this to be broken to check for correct source ordering
build_repo gem_repo3 do
build_repo3 do
build_gem "myrack", repo3_myrack_version do |s|
s.write "lib/myrack.rb", "MYRACK = 'FAIL'"
end
@ -156,7 +156,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
before do
# Oh no! Someone evil is trying to hijack myrack :(
# need this to be broken to check for correct source ordering
build_repo gem_repo3 do
build_repo3 do
build_gem "myrack", "1.0.0" do |s|
s.write "lib/myrack.rb", "MYRACK = 'FAIL'"
end
@ -200,7 +200,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
before do
# Oh no! Someone evil is trying to hijack myrack :(
# need this to be broken to check for correct source ordering
build_repo gem_repo3 do
build_repo3 do
build_gem "myrack", "1.0.0" do |s|
s.write "lib/myrack.rb", "MYRACK = 'FAIL'"
end
@ -225,7 +225,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "when a pinned gem has an indirect dependency in the pinned source" do
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "depends_on_myrack", "1.0.1" do |s|
s.add_dependency "myrack"
end
@ -287,7 +287,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
before do
# In these tests, we need a working myrack gem in repo2 and not repo3
build_repo gem_repo3 do
build_repo3 do
build_gem "depends_on_myrack", "1.0.1" do |s|
s.add_dependency "myrack"
end
@ -502,7 +502,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
before do
build_repo2
build_repo gem_repo3 do
build_repo3 do
build_gem "private_gem_1", "1.0.0"
build_gem "private_gem_2", "1.0.0"
end
@ -528,7 +528,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
before do
build_repo2
build_repo gem_repo3 do
build_repo3 do
build_gem "depends_on_missing", "1.0.1" do |s|
s.add_dependency "missing"
end
@ -565,7 +565,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
end
build_repo gem_repo3 do
build_repo3 do
build_gem "unrelated_gem", "1.0.0"
end
@ -645,7 +645,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "when a scoped gem has a deeply nested indirect dependency" do
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "depends_on_depends_on_myrack", "1.0.1" do |s|
s.add_dependency "depends_on_myrack"
end
@ -764,7 +764,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
build_gem "zeitwerk", "2.4.2"
end
build_repo gem_repo3 do
build_repo3 do
build_gem "sidekiq-pro", "5.2.1" do |s|
s.add_dependency "connection_pool", ">= 2.2.3"
s.add_dependency "sidekiq", ">= 6.1.0"
@ -1080,7 +1080,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "when a pinned gem has an indirect dependency with more than one level of indirection in the default source " do
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "handsoap", "0.2.5.5" do |s|
s.add_dependency "nokogiri", ">= 1.2.3"
end
@ -1157,7 +1157,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "with a gem that is only found in the wrong source" do
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "not_in_repo1", "1.0.0"
end
@ -1250,7 +1250,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
end
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "myrack", "0.9.1"
end
@ -1393,7 +1393,7 @@ RSpec.describe "bundle install with gems on multiple sources" do
context "re-resolving" do
context "when there is a mix of sources in the gemfile" do
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "myrack"
end

Просмотреть файл

@ -38,7 +38,7 @@ RSpec.describe "bundle install" do
describe "when prerelease gems are not available" do
it "still works" do
build_repo gem_repo3 do
build_repo3 do
build_gem "myrack"
end
FileUtils.rm_rf Dir[gem_repo3("prerelease*")]

Просмотреть файл

@ -454,7 +454,7 @@ RSpec.describe "major deprecations" do
context "bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes" do
before do
build_repo gem_repo3 do
build_repo3 do
build_gem "myrack", "0.9.1"
end

Просмотреть файл

@ -188,9 +188,15 @@ module Spec
# A repo that has no pre-installed gems included. (The caller completely
# determines the contents with the block.)
def build_repo3(**kwargs, &blk)
build_empty_repo gem_repo3, **kwargs, &blk
end
# Like build_repo3, this is a repo that has no pre-installed gems included.
# We have two different methods for situations where two different empty
# sources are needed.
def build_repo4(**kwargs, &blk)
FileUtils.rm_rf gem_repo4
build_repo(gem_repo4, **kwargs, &blk)
build_empty_repo gem_repo4, **kwargs, &blk
end
def update_repo4(&blk)
@ -307,6 +313,11 @@ module Spec
private
def build_empty_repo(gem_repo, **kwargs, &blk)
FileUtils.rm_rf gem_repo
build_repo(gem_repo, **kwargs, &blk)
end
def build_with(builder, name, args, &blk)
@_build_path ||= nil
@_build_repo ||= nil