summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_specification_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_specification_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_specification_command.rb53
1 files changed, 17 insertions, 36 deletions
diff --git a/test/rubygems/test_gem_commands_specification_command.rb b/test/rubygems/test_gem_commands_specification_command.rb
index 252d0bdd55..fb28302cc3 100644
--- a/test/rubygems/test_gem_commands_specification_command.rb
+++ b/test/rubygems/test_gem_commands_specification_command.rb
@@ -152,14 +152,9 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote
- foo = quick_gem 'foo'
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo
-
- FileUtils.rm File.join(@gemhome, 'specifications', foo.spec_name)
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', 1
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:domain] = :remote
@@ -173,16 +168,10 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote_with_version
- foo1 = quick_gem 'foo', "1"
- foo2 = quick_gem 'foo', "2"
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo1, foo2
-
- FileUtils.rm File.join(@gemhome, 'specifications', foo1.spec_name)
- FileUtils.rm File.join(@gemhome, 'specifications', foo2.spec_name)
+ spec_fetcher do |fetcher|
+ fetcher.spec 'foo', "1"
+ fetcher.spec 'foo', "2"
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:version] = "1"
@@ -198,16 +187,12 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote_without_prerelease
- foo = new_spec 'foo', '2.0.0'
- foo_pre = new_spec 'foo', '2.0.1.pre'
-
- install_specs foo, foo_pre
+ spec_fetcher do |fetcher|
+ foo = fetcher.spec 'foo', '2.0.0'
+ foo_pre = fetcher.spec 'foo', '2.0.1.pre'
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo
- util_setup_spec_fetcher foo_pre
+ install_specs foo, foo_pre
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:domain] = :remote
@@ -225,16 +210,12 @@ class TestGemCommandsSpecificationCommand < Gem::TestCase
end
def test_execute_remote_with_prerelease
- foo = new_spec 'foo', '2.0.0'
- foo_pre = new_spec 'foo', '2.0.1.pre'
+ spec_fetcher do |fetcher|
+ foo = fetcher.spec 'foo', '2.0.0'
+ foo_pre = fetcher.spec 'foo', '2.0.1.pre'
- install_specs foo, foo_pre
-
- @fetcher = Gem::FakeFetcher.new
- Gem::RemoteFetcher.fetcher = @fetcher
-
- util_setup_spec_fetcher foo
- util_setup_spec_fetcher foo_pre
+ install_specs foo, foo_pre
+ end
@cmd.options[:args] = %w[foo]
@cmd.options[:domain] = :remote