diff options
author | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-09 21:38:59 +0000 |
---|---|---|
committer | drbrain <drbrain@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2009-06-09 21:38:59 +0000 |
commit | 31c94ffeb5f09d09ac2c86fc9e6614e38251a43d (patch) | |
tree | 10e44506238c7af3d7c9d822111996731726e38d /test/rubygems/test_gem_commands_query_command.rb | |
parent | a6afbaeb3be396c0fdea3b9077d9256c59edcfca (diff) | |
download | ruby-31c94ffeb5f09d09ac2c86fc9e6614e38251a43d.tar.gz |
Update to RubyGems 1.3.4 r2223
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@23659 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_query_command.rb')
-rw-r--r-- | test/rubygems/test_gem_commands_query_command.rb | 122 |
1 files changed, 114 insertions, 8 deletions
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb index 785a08cd6c..228d0b3946 100644 --- a/test/rubygems/test_gem_commands_query_command.rb +++ b/test/rubygems/test_gem_commands_query_command.rb @@ -10,7 +10,7 @@ class TestGemCommandsQueryCommand < RubyGemTestCase util_setup_fake_fetcher - @si = util_setup_spec_fetcher @a1, @a2, @pl1 + @si = util_setup_spec_fetcher @a1, @a2, @pl1, @a3a @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do raise Gem::RemoteFetcher::FetchError @@ -85,6 +85,51 @@ a (2) This is a lot of text. pl (1) + Platform: i386-linux + Author: A User + Homepage: http://example.com + + this is a summary + EOF + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + + def test_execute_details_platform + @a1.platform = 'x86-linux' + + @a2.summary = 'This is a lot of text. ' * 4 + @a2.authors = ['Abraham Lincoln', 'Hirohito'] + @a2.homepage = 'http://a.example.com/' + @a2.rubyforge_project = 'rubygems' + @a2.platform = 'universal-darwin' + + @si = util_setup_spec_fetcher @a1, @a2, @pl1 + + @cmd.handle_options %w[-r -d] + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF + +*** REMOTE GEMS *** + +a (2, 1) + Platforms: + 1: x86-linux + 2: universal-darwin + Authors: Abraham Lincoln, Hirohito + Rubyforge: http://rubyforge.org/projects/rubygems + Homepage: http://a.example.com/ + + This is a lot of text. This is a lot of text. This is a lot of text. + This is a lot of text. + +pl (1) + Platform: i386-linux Author: A User Homepage: http://example.com @@ -207,11 +252,30 @@ RubyGems will revert to legacy indexes degrading performance. assert_equal expected, @ui.error end + def test_execute_legacy_prerelease + Gem::SpecFetcher.fetcher = nil + si = util_setup_source_info_cache @a1, @a2, @pl1 + + @fetcher.data["#{@gem_repo}yaml"] = YAML.dump si + @fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = + si.dump + + @fetcher.data.delete "#{@gem_repo}latest_specs.#{Gem.marshal_version}.gz" + + @cmd.handle_options %w[-r --prerelease] + + e = assert_raises Gem::OperationNotSupportedError do + @cmd.execute + end + + assert_equal 'Prereleases not supported on legacy repositories', e.message + end + def test_execute_local_details - @a2.summary = 'This is a lot of text. ' * 4 - @a2.authors = ['Abraham Lincoln', 'Hirohito'] - @a2.homepage = 'http://a.example.com/' - @a2.rubyforge_project = 'rubygems' + @a3a.summary = 'This is a lot of text. ' * 4 + @a3a.authors = ['Abraham Lincoln', 'Hirohito'] + @a3a.homepage = 'http://a.example.com/' + @a3a.rubyforge_project = 'rubygems' @cmd.handle_options %w[--local --details] @@ -223,10 +287,11 @@ RubyGems will revert to legacy indexes degrading performance. *** LOCAL GEMS *** -a (2, 1) +a (3.a, 2, 1) Author: A User Homepage: http://example.com - Installed at (2): #{@gemhome} + Installed at (3.a): #{@gemhome} + (2): #{@gemhome} (1): #{@gemhome} this is a summary @@ -253,6 +318,7 @@ c (1.2) this is a summary pl (1) + Platform: i386-linux Author: A User Homepage: http://example.com Installed at: #{@gemhome} @@ -274,7 +340,7 @@ pl (1) end expected = <<-EOF -a (2, 1) +a (3.a, 2, 1) a_evil (9) b (2) c (1.2) @@ -322,5 +388,45 @@ pl (1) assert_equal '', @ui.error end + def test_execute_prerelease + @cmd.handle_options %w[-r --prerelease] + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF + +*** REMOTE GEMS *** + +a (3.a) + EOF + + assert_equal expected, @ui.output + assert_equal '', @ui.error + end + + def test_execute_prerelease_local + @cmd.handle_options %w[-l --prerelease] + + use_ui @ui do + @cmd.execute + end + + expected = <<-EOF + +*** LOCAL GEMS *** + +a (3.a, 2, 1) +a_evil (9) +b (2) +c (1.2) +pl (1) + EOF + + assert_equal expected, @ui.output + assert_equal "WARNING: prereleases are always shown locally\n", @ui.error + end + end |