diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-12 00:16:41 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2013-11-12 00:16:41 +0000 |
commit | 44d0a6dcd7563526a8b05ccdfa21d9425b94e62b (patch) | |
tree | e3bc8e5f1284e65a70c61de9a9d349d5fc8a8640 /test/rubygems/test_gem_commands_sources_command.rb | |
parent | 8f3934261ad4a7f486d2fffa9c961d7535675d8f (diff) | |
download | ruby-44d0a6dcd7563526a8b05ccdfa21d9425b94e62b.tar.gz |
* lib/rubygems: Update to RubyGems master b9213d7. Changes include:
Fixed tests on Windows (I hope) by forcing platform for
platform-dependent tests.
Fixed File.exists? warnings.
Improved testing infrastructure.
* test/rubygems: ditto.
* test/rdoc/test_rdoc_rubygems_hook.rb: Switch to util_spec like
RubyGems.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@43651 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_sources_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_sources_command.rb | 53 |
1 files changed, 10 insertions, 43 deletions
diff --git a/test/rubygems/test_gem_commands_sources_command.rb b/test/rubygems/test_gem_commands_sources_command.rb index d1f39425ed..8ee0fd3cb7 100644 --- a/test/rubygems/test_gem_commands_sources_command.rb +++ b/test/rubygems/test_gem_commands_sources_command.rb @@ -6,7 +6,7 @@ class TestGemCommandsSourcesCommand < Gem::TestCase def setup super - util_setup_fake_fetcher + spec_fetcher @cmd = Gem::Commands::SourcesCommand.new @@ -18,7 +18,6 @@ class TestGemCommandsSourcesCommand < Gem::TestCase end def test_execute - util_setup_spec_fetcher @cmd.handle_options [] use_ui @ui do @@ -36,9 +35,9 @@ class TestGemCommandsSourcesCommand < Gem::TestCase end def test_execute_add - util_setup_fake_fetcher - - install_specs @a1 + spec_fetcher do |fetcher| + fetcher.spec 'a', 1 + end specs = Gem::Specification.map { |spec| [spec.name, spec.version, spec.original_platform] @@ -54,8 +53,6 @@ class TestGemCommandsSourcesCommand < Gem::TestCase @cmd.handle_options %W[--add #{@new_repo}] - util_setup_spec_fetcher - use_ui @ui do @cmd.execute end @@ -71,19 +68,13 @@ class TestGemCommandsSourcesCommand < Gem::TestCase end def test_execute_add_nonexistent_source - util_setup_fake_fetcher - uri = "http://beta-gems.example.com/specs.#{@marshal_version}.gz" @fetcher.data[uri] = proc do raise Gem::RemoteFetcher::FetchError.new('it died', uri) end - Gem::RemoteFetcher.fetcher = @fetcher - @cmd.handle_options %w[--add http://beta-gems.example.com] - util_setup_spec_fetcher - use_ui @ui do assert_raises Gem::MockGemUi::TermError do @cmd.execute @@ -102,8 +93,6 @@ Error fetching http://beta-gems.example.com: def test_execute_add_redundant_source @cmd.handle_options %W[--add #{@gem_repo}] - util_setup_spec_fetcher - use_ui @ui do @cmd.execute end @@ -120,9 +109,10 @@ source #{@gem_repo} already present in the cache def test_execute_add_http_rubygems_org http_rubygems_org = 'http://rubygems.org' - util_setup_fake_fetcher - install_specs @a1 + spec_fetcher do |fetcher| + fetcher.spec 'a', 1 + end specs = Gem::Specification.map { |spec| [spec.name, spec.version, spec.original_platform] @@ -138,8 +128,6 @@ source #{@gem_repo} already present in the cache @cmd.handle_options %W[--add #{http_rubygems_org}] - util_setup_spec_fetcher - ui = Gem::MockGemUi.new "n" use_ui ui do @@ -160,8 +148,6 @@ source #{@gem_repo} already present in the cache def test_execute_add_bad_uri @cmd.handle_options %w[--add beta-gems.example.com] - util_setup_spec_fetcher - use_ui @ui do assert_raises Gem::MockGemUi::TermError do @cmd.execute @@ -181,8 +167,6 @@ beta-gems.example.com is not a URI def test_execute_clear_all @cmd.handle_options %w[--clear-all] - util_setup_spec_fetcher - use_ui @ui do @cmd.execute end @@ -218,8 +202,6 @@ beta-gems.example.com is not a URI def test_execute_remove @cmd.handle_options %W[--remove #{@gem_repo}] - util_setup_spec_fetcher - use_ui @ui do @cmd.execute end @@ -233,8 +215,6 @@ beta-gems.example.com is not a URI def test_execute_remove_no_network @cmd.handle_options %W[--remove #{@gem_repo}] - util_setup_fake_fetcher - @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do raise Gem::RemoteFetcher::FetchError end @@ -252,22 +232,9 @@ beta-gems.example.com is not a URI def test_execute_update @cmd.handle_options %w[--update] - util_setup_fake_fetcher - util_setup_spec_fetcher @a1 - - specs = Gem::Specification.map { |spec| - [spec.name, spec.version, spec.original_platform] - } - - @fetcher.data["#{@gem_repo}specs.#{Gem.marshal_version}.gz"] = - util_gzip Marshal.dump(specs) - - latest_specs = Gem::Specification.latest_specs.map { |spec| - [spec.name, spec.version, spec.original_platform] - } - - @fetcher.data["#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz"] = - util_gzip Marshal.dump(latest_specs) + spec_fetcher do |fetcher| + fetcher.gem 'a', 1 + end use_ui @ui do @cmd.execute |