aboutsummaryrefslogtreecommitdiffstats
path: root/test/rubygems/test_gem_commands_contents_command.rb
diff options
context:
space:
mode:
authorryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
committerryan <ryan@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2011-06-01 03:45:05 +0000
commitd22130922e7842226d38d59680e4bbb48a28a5f0 (patch)
tree39594d3a14641dd5488a99a5e633239296fa5742 /test/rubygems/test_gem_commands_contents_command.rb
parent4752539e3f3e563d559732c52424206bd6f12dbd (diff)
downloadruby-d22130922e7842226d38d59680e4bbb48a28a5f0.tar.gz
Import rubygems 1.8.5 (released @ 137c80f)
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@31885 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'test/rubygems/test_gem_commands_contents_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_contents_command.rb49
1 files changed, 19 insertions, 30 deletions
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index 6b9750e861..cf927e73dd 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -15,11 +15,18 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd = Gem::Commands::ContentsCommand.new
end
+ def gem name
+ spec = quick_gem name do |gem|
+ gem.files = %W[lib/#{name}.rb Rakefile]
+ end
+ write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb])
+ write_file File.join(*%W[gems #{spec.full_name} Rakefile])
+ end
+
def test_execute
@cmd.options[:args] = %w[foo]
- quick_gem 'foo' do |gem|
- gem.files = %w[lib/foo.rb Rakefile]
- end
+
+ gem 'foo'
use_ui @ui do
@cmd.execute
@@ -33,13 +40,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_all
@cmd.options[:all] = true
- quick_gem 'foo' do |gem|
- gem.files = %w[lib/foo.rb Rakefile]
- end
-
- quick_gem 'bar' do |gem|
- gem.files = %w[lib/bar.rb Rakefile]
- end
+ gem 'foo'
+ gem 'bar'
use_ui @ui do
@cmd.execute
@@ -67,13 +69,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_exact_match
@cmd.options[:args] = %w[foo]
- quick_gem 'foo' do |gem|
- gem.files = %w[lib/foo.rb Rakefile]
- end
-
- quick_gem 'foo_bar' do |gem|
- gem.files = %w[lib/foo_bar.rb Rakefile]
- end
+ gem 'foo'
+ gem 'bar'
use_ui @ui do
@cmd.execute
@@ -88,9 +85,7 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd.options[:args] = %w[foo]
@cmd.options[:lib_only] = true
- quick_gem 'foo' do |gem|
- gem.files = %w[lib/foo.rb Rakefile]
- end
+ gem 'foo'
use_ui @ui do
@cmd.execute
@@ -104,13 +99,9 @@ class TestGemCommandsContentsCommand < Gem::TestCase
def test_execute_multiple
@cmd.options[:args] = %w[foo bar]
- quick_gem 'foo' do |gem|
- gem.files = %w[lib/foo.rb Rakefile]
- end
- quick_gem 'bar' do |gem|
- gem.files = %w[lib/bar.rb Rakefile]
- end
+ gem 'foo'
+ gem 'bar'
use_ui @ui do
@cmd.execute
@@ -126,17 +117,15 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd.options[:args] = %w[foo]
@cmd.options[:prefix] = false
- quick_gem 'foo' do |gem|
- gem.files = %w[lib/foo.rb Rakefile]
- end
+ gem 'foo'
use_ui @ui do
@cmd.execute
end
expected = <<-EOF
-lib/foo.rb
Rakefile
+lib/foo.rb
EOF
assert_equal expected, @ui.output