summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_query_command.rb
diff options
context:
space:
mode:
Diffstat (limited to 'test/rubygems/test_gem_commands_query_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_query_command.rb97
1 files changed, 15 insertions, 82 deletions
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index 91868b8..4f06968 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -15,8 +15,8 @@ class TestGemCommandsQueryCommand < Gem::TestCase
@cmd = Gem::Commands::QueryCommand.new
util_setup_fake_fetcher
-
- @si = util_setup_spec_fetcher @a1, @a2, @pl1, @a3a
+ util_clear_gems
+ util_setup_spec_fetcher @a1, @a2, @pl1, @a3a
@fetcher.data["#{@gem_repo}Marshal.#{Gem.marshal_version}"] = proc do
raise Gem::RemoteFetcher::FetchError
@@ -48,7 +48,8 @@ pl (1 i386-linux)
@a1.platform = 'x86-linux'
@a2.platform = 'universal-darwin'
- @si = util_setup_spec_fetcher @a1, @a1r, @a2, @b2, @pl1
+ util_clear_gems
+ util_setup_spec_fetcher @a1, @a1r, @a2, @b2, @pl1
@cmd.handle_options %w[-r -a]
@@ -113,7 +114,8 @@ pl (1 i386-linux)
@a2.homepage = 'http://a.example.com/'
@a2.rubyforge_project = 'rubygems'
- @si = util_setup_spec_fetcher @a1, @a2, @pl1
+ util_clear_gems
+ util_setup_spec_fetcher @a1, @a2, @pl1
@cmd.handle_options %w[-r -d]
@@ -154,7 +156,8 @@ pl (1)
@a2.rubyforge_project = 'rubygems'
@a2.platform = 'universal-darwin'
- @si = util_setup_spec_fetcher @a1, @a2, @pl1
+ util_clear_gems
+ util_setup_spec_fetcher @a1, @a2, @pl1
@cmd.handle_options %w[-r -d]
@@ -190,25 +193,22 @@ pl (1)
end
def test_execute_installed
- @cmd.handle_options %w[-n c --installed]
+ @cmd.handle_options %w[-n a --installed]
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException do
use_ui @ui do
@cmd.execute
end
end
- assert_equal 0, e.exit_code
-
assert_equal "true\n", @ui.output
-
assert_equal '', @ui.error
end
def test_execute_installed_no_name
@cmd.handle_options %w[--installed]
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
@@ -223,7 +223,7 @@ pl (1)
def test_execute_installed_not_installed
@cmd.handle_options %w[-n not_installed --installed]
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
@@ -236,9 +236,9 @@ pl (1)
end
def test_execute_installed_version
- @cmd.handle_options %w[-n c --installed --version 1.2]
+ @cmd.handle_options %w[-n a --installed --version 2]
- e = assert_raises Gem::SystemExitException do
+ assert_raises Gem::MockGemUi::SystemExitException do
use_ui @ui do
@cmd.execute
end
@@ -246,14 +246,12 @@ pl (1)
assert_equal "true\n", @ui.output
assert_equal '', @ui.error
-
- assert_equal 0, e.exit_code
end
def test_execute_installed_version_not_installed
@cmd.handle_options %w[-n c --installed --version 2]
- e = assert_raises Gem::SystemExitException do
+ e = assert_raises Gem::MockGemUi::TermError do
use_ui @ui do
@cmd.execute
end
@@ -265,65 +263,6 @@ pl (1)
assert_equal 1, e.exit_code
end
- def test_execute_local_details
- @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]
-
- use_ui @ui do
- @cmd.execute
- end
-
- expected = <<-EOF
-
-*** LOCAL GEMS ***
-
-a (3.a, 2, 1)
- Author: A User
- Homepage: http://example.com
- Installed at (3.a): #{@gemhome}
- (2): #{@gemhome}
- (1): #{@gemhome}
-
- this is a summary
-
-a_evil (9)
- Author: A User
- Homepage: http://example.com
- Installed at: #{@gemhome}
-
- this is a summary
-
-b (2)
- Author: A User
- Homepage: http://example.com
- Installed at: #{@gemhome}
-
- this is a summary
-
-c (1.2)
- Author: A User
- Homepage: http://example.com
- Installed at: #{@gemhome}
-
- this is a summary
-
-pl (1)
- Platform: i386-linux
- Author: A User
- Homepage: http://example.com
- Installed at: #{@gemhome}
-
- this is a summary
- EOF
-
- assert_equal expected, @ui.output
- assert_equal '', @ui.error
- end
-
def test_execute_local_notty
@cmd.handle_options %w[]
@@ -335,9 +274,6 @@ pl (1)
expected = <<-EOF
a (3.a, 2, 1)
-a_evil (9)
-b (2)
-c (1.2)
pl (1 i386-linux)
EOF
@@ -412,9 +348,6 @@ a (3.a)
*** LOCAL GEMS ***
a (3.a, 2, 1)
-a_evil (9)
-b (2)
-c (1.2)
pl (1 i386-linux)
EOF