Skip to content

Commit 4e508a1

Browse files
committed
Move some gem install tests to Compact Index API.
1 parent 46b1187 commit 4e508a1

File tree

1 file changed

+53
-53
lines changed

1 file changed

+53
-53
lines changed

test/rubygems/test_gem_commands_install_command.rb

Lines changed: 53 additions & 53 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ def teardown
2929
end
3030

3131
def test_execute_exclude_prerelease
32-
spec_fetcher do |fetcher|
33-
fetcher.gem "a", 2
34-
fetcher.gem "a", "2.pre"
32+
compact_index do |ci|
33+
ci.gem "a", 2
34+
ci.gem "a", "2.pre"
3535
end
3636

3737
@cmd.options[:args] = %w[a]
@@ -46,9 +46,9 @@ def test_execute_exclude_prerelease
4646
end
4747

4848
def test_execute_explicit_version_includes_prerelease
49-
specs = spec_fetcher do |fetcher|
50-
fetcher.gem "a", 2
51-
fetcher.gem "a", "2.a"
49+
specs = compact_index do |ci|
50+
ci.gem "a", 2
51+
ci.gem "a", "2.a"
5252
end
5353

5454
a2_pre = specs["a-2.a"]
@@ -430,9 +430,9 @@ def test_execute_nonexistent_with_dashes
430430
end
431431

432432
def test_execute_prerelease_skipped_when_no_flag_set
433-
spec_fetcher do |fetcher|
434-
fetcher.gem "a", 1
435-
fetcher.gem "a", "3.a"
433+
compact_index do |ci|
434+
ci.gem "a", 1
435+
ci.gem "a", "3.a"
436436
end
437437

438438
@cmd.options[:prerelease] = false
@@ -483,9 +483,9 @@ def test_execute_with_version_specified_by_colon
483483
end
484484

485485
def test_execute_prerelease_skipped_when_non_pre_available
486-
spec_fetcher do |fetcher|
487-
fetcher.gem "a", "2.pre"
488-
fetcher.gem "a", 2
486+
compact_index do |ci|
487+
ci.gem "a", "2.pre"
488+
ci.gem "a", 2
489489
end
490490

491491
@cmd.options[:prerelease] = true
@@ -532,9 +532,9 @@ def test_execute_required_ruby_version
532532

533533
def test_execute_required_ruby_version_upper_bound
534534
local = Gem::Platform.local
535-
spec_fetcher do |fetcher|
536-
fetcher.gem "a", 2.0
537-
fetcher.gem "a", 2.0 do |s|
535+
compact_index do |ci|
536+
ci.gem "a", 2.0
537+
ci.gem "a", 2.0 do |s|
538538
s.required_ruby_version = "< #{RUBY_VERSION}.a"
539539
s.platform = local
540540
end
@@ -552,8 +552,8 @@ def test_execute_required_ruby_version_upper_bound
552552
end
553553

554554
def test_execute_required_ruby_version_specific_not_met
555-
spec_fetcher do |fetcher|
556-
fetcher.gem "a", "1.0" do |s|
555+
compact_index do |ci|
556+
ci.gem "a", "1.0" do |s|
557557
s.required_ruby_version = "= 1.4.6"
558558
end
559559
end
@@ -572,8 +572,8 @@ def test_execute_required_ruby_version_specific_not_met
572572
end
573573

574574
def test_execute_required_ruby_version_specific_prerelease_met
575-
spec_fetcher do |fetcher|
576-
fetcher.gem "a", "1.0" do |s|
575+
compact_index do |ci|
576+
ci.gem "a", "1.0" do |s|
577577
s.required_ruby_version = ">= 1.4.6.preview2"
578578
end
579579
end
@@ -592,8 +592,8 @@ def test_execute_required_ruby_version_specific_prerelease_met
592592
def test_execute_required_ruby_version_specific_prerelease_not_met
593593
next_ruby_pre = Gem.ruby_version.segments.map.with_index {|n, i| i == 1 ? n + 1 : n }.join(".") + ".a"
594594

595-
spec_fetcher do |fetcher|
596-
fetcher.gem "a", "1.0" do |s|
595+
compact_index do |ci|
596+
ci.gem "a", "1.0" do |s|
597597
s.required_ruby_version = "> #{next_ruby_pre}"
598598
end
599599
end
@@ -612,8 +612,8 @@ def test_execute_required_ruby_version_specific_prerelease_not_met
612612
end
613613

614614
def test_execute_required_rubygems_version_wrong
615-
spec_fetcher do |fetcher|
616-
fetcher.gem "a", "1.0" do |s|
615+
compact_index do |ci|
616+
ci.gem "a", "1.0" do |s|
617617
s.required_rubygems_version = "< 0"
618618
end
619619
end
@@ -632,8 +632,8 @@ def test_execute_required_rubygems_version_wrong
632632
end
633633

634634
def test_execute_rdoc
635-
specs = spec_fetcher do |fetcher|
636-
fetcher.gem "a", 2
635+
specs = compact_index do |ci|
636+
ci.gem "a", 2
637637
end
638638

639639
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
@@ -661,8 +661,8 @@ def test_execute_rdoc
661661
end if defined?(Gem::RDoc) && !Gem.rdoc_hooks_defined_via_plugin?
662662

663663
def test_execute_rdoc_with_path
664-
specs = spec_fetcher do |fetcher|
665-
fetcher.gem "a", 2
664+
specs = compact_index do |ci|
665+
ci.gem "a", 2
666666
end
667667

668668
Gem.done_installing(&Gem::RDoc.method(:generation_hook))
@@ -690,8 +690,8 @@ def test_execute_rdoc_with_path
690690
end if defined?(Gem::RDoc) && !Gem.rdoc_hooks_defined_via_plugin?
691691

692692
def test_execute_saves_build_args
693-
specs = spec_fetcher do |fetcher|
694-
fetcher.gem "a", 2
693+
specs = compact_index do |ci|
694+
ci.gem "a", 2
695695
end
696696

697697
args = %w[--with-awesome=true --more-awesome=yes]
@@ -720,8 +720,8 @@ def test_execute_saves_build_args
720720
end
721721

722722
def test_execute_remote
723-
spec_fetcher do |fetcher|
724-
fetcher.gem "a", 2
723+
compact_index do |ci|
724+
ci.gem "a", 2
725725
end
726726

727727
@cmd.options[:args] = %w[a]
@@ -740,8 +740,8 @@ def test_execute_remote
740740
def test_execute_with_invalid_gem_file
741741
FileUtils.touch("a.gem")
742742

743-
spec_fetcher do |fetcher|
744-
fetcher.gem "a", 2
743+
compact_index do |ci|
744+
ci.gem "a", 2
745745
end
746746

747747
@cmd.options[:args] = %w[a]
@@ -758,8 +758,8 @@ def test_execute_with_invalid_gem_file
758758
end
759759

760760
def test_execute_remote_truncates_existing_gemspecs
761-
spec_fetcher do |fetcher|
762-
fetcher.gem "a", 1
761+
compact_index do |ci|
762+
ci.gem "a", 1
763763
end
764764

765765
@cmd.options[:domain] = :remote
@@ -791,9 +791,9 @@ def test_execute_remote_truncates_existing_gemspecs
791791
end
792792

793793
def test_execute_remote_ignores_files
794-
specs = spec_fetcher do |fetcher|
795-
fetcher.gem "a", 1
796-
fetcher.gem "a", 2
794+
specs = compact_index do |ci|
795+
ci.gem "a", 1
796+
ci.gem "a", 2
797797
end
798798

799799
@cmd.options[:domain] = :remote
@@ -887,11 +887,11 @@ def test_execute_two_version
887887
end
888888

889889
def test_execute_two_version_specified_by_colon
890-
spec_fetcher do |fetcher|
891-
fetcher.gem "a", 1
892-
fetcher.gem "a", 2
893-
fetcher.gem "b", 1
894-
fetcher.gem "b", 2
890+
compact_index do |ci|
891+
ci.gem "a", 1
892+
ci.gem "a", 2
893+
ci.gem "b", 1
894+
ci.gem "b", 2
895895
end
896896

897897
@cmd.options[:args] = %w[a:1 b:1]
@@ -956,8 +956,8 @@ def test_install_gem_ignore_dependencies_both
956956
end
957957

958958
def test_install_gem_ignore_dependencies_remote
959-
spec_fetcher do |fetcher|
960-
fetcher.gem "a", 2
959+
compact_index do |ci|
960+
ci.gem "a", 2
961961
end
962962

963963
@cmd.options[:ignore_dependencies] = true
@@ -969,10 +969,10 @@ def test_install_gem_ignore_dependencies_remote
969969

970970
def test_install_gem_ignore_dependencies_remote_platform_local
971971
local = Gem::Platform.local
972-
spec_fetcher do |fetcher|
973-
fetcher.gem "a", 3
972+
compact_index do |ci|
973+
ci.gem "a", 3
974974

975-
fetcher.gem "a", 3 do |s|
975+
ci.gem "a", 3 do |s|
976976
s.platform = local
977977
end
978978
end
@@ -1365,9 +1365,9 @@ def test_execute_with_gemdeps_path_ignores_system
13651365
end
13661366

13671367
def test_execute_uses_deps_a_gemdeps_with_a_path
1368-
specs = spec_fetcher do |fetcher|
1369-
fetcher.gem "q", "1.0"
1370-
fetcher.gem "r", "2.0", "q" => nil
1368+
specs = compact_index do |ci|
1369+
ci.gem "q", "1.0"
1370+
ci.gem "r", "2.0", "q" => nil
13711371
end
13721372

13731373
i = Gem::Installer.at specs["q-1.0"].cache_file, install_dir: "gf-path"
@@ -1568,8 +1568,8 @@ def test_explain_platform_ruby_ignore_dependencies
15681568

15691569
def test_suggest_update_if_enabled
15701570
TestUpdateSuggestion.with_eligible_environment(cmd: @cmd) do
1571-
spec_fetcher do |fetcher|
1572-
fetcher.gem "a", 2
1571+
compact_index do |ci|
1572+
ci.gem "a", 2
15731573
end
15741574

15751575
@cmd.options[:args] = %w[a]

0 commit comments

Comments
 (0)