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.rb56
1 files changed, 55 insertions, 1 deletions
diff --git a/test/rubygems/test_gem_commands_query_command.rb b/test/rubygems/test_gem_commands_query_command.rb
index 223f205b2d..d8d682b136 100644
--- a/test/rubygems/test_gem_commands_query_command.rb
+++ b/test/rubygems/test_gem_commands_query_command.rb
@@ -642,7 +642,7 @@ pl (1)
assert_equal expected, @ui.output
end
- def test_execute_exact
+ def test_execute_exact_remote
spec_fetcher do |fetcher|
fetcher.spec 'coolgem-omg', 3
fetcher.spec 'coolgem', '4.2.1'
@@ -665,6 +665,60 @@ coolgem (4.2.1)
assert_equal expected, @ui.output
end
+ def test_execute_exact_local
+ spec_fetcher do |fetcher|
+ fetcher.spec 'coolgem-omg', 3
+ fetcher.spec 'coolgem', '4.2.1'
+ fetcher.spec 'wow_coolgem', 1
+ end
+
+ @cmd.handle_options %w[--exact coolgem]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+
+*** LOCAL GEMS ***
+
+coolgem (4.2.1)
+ EOF
+
+ assert_equal expected, @ui.output
+ end
+
+ def test_execute_exact_multiple
+ spec_fetcher do |fetcher|
+ fetcher.spec 'coolgem-omg', 3
+ fetcher.spec 'coolgem', '4.2.1'
+ fetcher.spec 'wow_coolgem', 1
+
+ fetcher.spec 'othergem-omg', 3
+ fetcher.spec 'othergem', '1.2.3'
+ fetcher.spec 'wow_othergem', 1
+ end
+
+ @cmd.handle_options %w[--exact coolgem othergem]
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = <<-EOF
+
+*** LOCAL GEMS ***
+
+coolgem (4.2.1)
+
+*** LOCAL GEMS ***
+
+othergem (1.2.3)
+ EOF
+
+ assert_equal expected, @ui.output
+ end
+
private
def add_gems_to_fetcher