Skip to content

Commit d8cf4aa

Browse files
Extract a build_repo3 helper
1 parent 651cf3e commit d8cf4aa

7 files changed

Lines changed: 32 additions & 21 deletions

File tree

bundler/spec/commands/outdated_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@
162162
build_gem "vcr", "6.0.0"
163163
end
164164

165-
build_repo gem_repo3 do
165+
build_repo3 do
166166
build_gem "pkg-gem-flowbyte-with-dep", "1.0.0" do |s|
167167
s.add_dependency "oj"
168168
end

bundler/spec/commands/remove_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -409,7 +409,7 @@
409409

410410
context "with sources" do
411411
before do
412-
build_repo gem_repo3 do
412+
build_repo3 do
413413
build_gem "rspec"
414414
end
415415
end

bundler/spec/commands/update_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -956,7 +956,7 @@
956956
build_gem "vcr", "6.0.0"
957957
end
958958

959-
build_repo gem_repo3 do
959+
build_repo3 do
960960
build_gem "pkg-gem-flowbyte-with-dep", "1.0.0" do |s|
961961
s.add_dependency "oj"
962962
end

bundler/spec/install/gemfile/sources_spec.rb

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
before do
99
# Oh no! Someone evil is trying to hijack myrack :(
1010
# need this to be broken to check for correct source ordering
11-
build_repo gem_repo3 do
11+
build_repo3 do
1212
build_gem "myrack", repo3_myrack_version do |s|
1313
s.write "lib/myrack.rb", "MYRACK = 'FAIL'"
1414
end
@@ -156,7 +156,7 @@
156156
before do
157157
# Oh no! Someone evil is trying to hijack myrack :(
158158
# need this to be broken to check for correct source ordering
159-
build_repo gem_repo3 do
159+
build_repo3 do
160160
build_gem "myrack", "1.0.0" do |s|
161161
s.write "lib/myrack.rb", "MYRACK = 'FAIL'"
162162
end
@@ -200,7 +200,7 @@
200200
before do
201201
# Oh no! Someone evil is trying to hijack myrack :(
202202
# need this to be broken to check for correct source ordering
203-
build_repo gem_repo3 do
203+
build_repo3 do
204204
build_gem "myrack", "1.0.0" do |s|
205205
s.write "lib/myrack.rb", "MYRACK = 'FAIL'"
206206
end
@@ -225,7 +225,7 @@
225225

226226
context "when a pinned gem has an indirect dependency in the pinned source" do
227227
before do
228-
build_repo gem_repo3 do
228+
build_repo3 do
229229
build_gem "depends_on_myrack", "1.0.1" do |s|
230230
s.add_dependency "myrack"
231231
end
@@ -287,7 +287,7 @@
287287
before do
288288
# In these tests, we need a working myrack gem in repo2 and not repo3
289289

290-
build_repo gem_repo3 do
290+
build_repo3 do
291291
build_gem "depends_on_myrack", "1.0.1" do |s|
292292
s.add_dependency "myrack"
293293
end
@@ -502,7 +502,7 @@
502502
before do
503503
build_repo2
504504

505-
build_repo gem_repo3 do
505+
build_repo3 do
506506
build_gem "private_gem_1", "1.0.0"
507507
build_gem "private_gem_2", "1.0.0"
508508
end
@@ -528,7 +528,7 @@
528528
before do
529529
build_repo2
530530

531-
build_repo gem_repo3 do
531+
build_repo3 do
532532
build_gem "depends_on_missing", "1.0.1" do |s|
533533
s.add_dependency "missing"
534534
end
@@ -565,7 +565,7 @@
565565
end
566566
end
567567

568-
build_repo gem_repo3 do
568+
build_repo3 do
569569
build_gem "unrelated_gem", "1.0.0"
570570
end
571571

@@ -645,7 +645,7 @@
645645

646646
context "when a scoped gem has a deeply nested indirect dependency" do
647647
before do
648-
build_repo gem_repo3 do
648+
build_repo3 do
649649
build_gem "depends_on_depends_on_myrack", "1.0.1" do |s|
650650
s.add_dependency "depends_on_myrack"
651651
end
@@ -764,7 +764,7 @@
764764
build_gem "zeitwerk", "2.4.2"
765765
end
766766

767-
build_repo gem_repo3 do
767+
build_repo3 do
768768
build_gem "sidekiq-pro", "5.2.1" do |s|
769769
s.add_dependency "connection_pool", ">= 2.2.3"
770770
s.add_dependency "sidekiq", ">= 6.1.0"
@@ -1080,7 +1080,7 @@
10801080

10811081
context "when a pinned gem has an indirect dependency with more than one level of indirection in the default source " do
10821082
before do
1083-
build_repo gem_repo3 do
1083+
build_repo3 do
10841084
build_gem "handsoap", "0.2.5.5" do |s|
10851085
s.add_dependency "nokogiri", ">= 1.2.3"
10861086
end
@@ -1157,7 +1157,7 @@
11571157

11581158
context "with a gem that is only found in the wrong source" do
11591159
before do
1160-
build_repo gem_repo3 do
1160+
build_repo3 do
11611161
build_gem "not_in_repo1", "1.0.0"
11621162
end
11631163

@@ -1250,7 +1250,7 @@
12501250
end
12511251

12521252
before do
1253-
build_repo gem_repo3 do
1253+
build_repo3 do
12541254
build_gem "myrack", "0.9.1"
12551255
end
12561256

@@ -1393,7 +1393,7 @@
13931393
context "re-resolving" do
13941394
context "when there is a mix of sources in the gemfile" do
13951395
before do
1396-
build_repo gem_repo3 do
1396+
build_repo3 do
13971397
build_gem "myrack"
13981398
end
13991399

bundler/spec/install/prereleases_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838

3939
describe "when prerelease gems are not available" do
4040
it "still works" do
41-
build_repo gem_repo3 do
41+
build_repo3 do
4242
build_gem "myrack"
4343
end
4444
FileUtils.rm_rf Dir[gem_repo3("prerelease*")]

bundler/spec/other/major_deprecation_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@
454454

455455
context "bundle install in frozen mode with a lockfile with a single rubygems section with multiple remotes" do
456456
before do
457-
build_repo gem_repo3 do
457+
build_repo3 do
458458
build_gem "myrack", "0.9.1"
459459
end
460460

bundler/spec/support/builders.rb

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,9 +188,15 @@ def build_repo2(**kwargs, &blk)
188188

189189
# A repo that has no pre-installed gems included. (The caller completely
190190
# determines the contents with the block.)
191+
def build_repo3(**kwargs, &blk)
192+
build_empty_repo gem_repo3, **kwargs, &blk
193+
end
194+
195+
# Like build_repo3, this is a repo that has no pre-installed gems included.
196+
# We have two different methods for situations where two different empty
197+
# sources are needed.
191198
def build_repo4(**kwargs, &blk)
192-
FileUtils.rm_rf gem_repo4
193-
build_repo(gem_repo4, **kwargs, &blk)
199+
build_empty_repo gem_repo4, **kwargs, &blk
194200
end
195201

196202
def update_repo4(&blk)
@@ -307,6 +313,11 @@ def build_plugin(name, *args, &blk)
307313

308314
private
309315

316+
def build_empty_repo(gem_repo, **kwargs, &blk)
317+
FileUtils.rm_rf gem_repo
318+
build_repo(gem_repo, **kwargs, &blk)
319+
end
320+
310321
def build_with(builder, name, args, &blk)
311322
@_build_path ||= nil
312323
@_build_repo ||= nil

0 commit comments

Comments
 (0)