summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_contents_command.rb
diff options
context:
space:
mode:
authorhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-14 03:30:02 +0000
committerhsbt <hsbt@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2014-09-14 03:30:02 +0000
commit4de117a61517e839f2c45eaf45d56fc243d6d5b2 (patch)
tree7cb5af7a7eb513e5dddf5e343746b1611e628387 /test/rubygems/test_gem_commands_contents_command.rb
parente548c09d429a5136285ea81aed418685359ed124 (diff)
* lib/rubygems: Update to RubyGems 2.4.1 master(713ab65)
Complete history at: https://github.com/rubygems/rubygems/blob/master/History.txt#L3-L216 * test/rubygems: ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@47582 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, 46 insertions, 3 deletions
diff --git a/test/rubygems/test_gem_commands_contents_command.rb b/test/rubygems/test_gem_commands_contents_command.rb
index 7f5cf22223..fb6906afd2 100644
--- a/test/rubygems/test_gem_commands_contents_command.rb
+++ b/test/rubygems/test_gem_commands_contents_command.rb
@@ -9,8 +9,8 @@ class TestGemCommandsContentsCommand < Gem::TestCase
@cmd = Gem::Commands::ContentsCommand.new
end
- def gem name
- spec = quick_gem name do |gem|
+ def gem name, version = 2
+ spec = quick_gem name, version do |gem|
gem.files = %W[lib/#{name}.rb Rakefile]
end
write_file File.join(*%W[gems #{spec.full_name} lib #{name}.rb])
@@ -135,6 +135,40 @@ class TestGemCommandsContentsCommand < Gem::TestCase
assert_equal "", @ui.error
end
+ def test_execute_show_install_dir
+ @cmd.options[:args] = %w[foo]
+ @cmd.options[:show_install_dir] = true
+
+ gem 'foo'
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = File.join @gemhome, 'gems', 'foo-2'
+
+ assert_equal "#{expected}\n", @ui.output
+ assert_equal "", @ui.error
+ end
+
+ def test_execute_show_install_dir_version
+ @cmd.options[:args] = %w[foo]
+ @cmd.options[:show_install_dir] = true
+ @cmd.options[:version] = Gem::Requirement.new '= 1'
+
+ gem 'foo', 1
+ gem 'foo', 2
+
+ use_ui @ui do
+ @cmd.execute
+ end
+
+ expected = File.join @gemhome, 'gems', 'foo-1'
+
+ assert_equal "#{expected}\n", @ui.output
+ assert_equal "", @ui.error
+ end
+
def test_execute_no_prefix
@cmd.options[:args] = %w[foo]
@cmd.options[:prefix] = false
@@ -183,13 +217,22 @@ lib/foo.rb
assert @cmd.options[:prefix]
assert_empty @cmd.options[:specdirs]
assert_nil @cmd.options[:version]
+ refute @cmd.options[:show_install_dir]
- @cmd.send :handle_options, %w[-l -s foo --version 0.0.2 --no-prefix]
+ @cmd.send :handle_options, %w[
+ -l
+ -s
+ foo
+ --version 0.0.2
+ --no-prefix
+ --show-install-dir
+ ]
assert @cmd.options[:lib_only]
refute @cmd.options[:prefix]
assert_equal %w[foo], @cmd.options[:specdirs]
assert_equal Gem::Requirement.new('0.0.2'), @cmd.options[:version]
+ assert @cmd.options[:show_install_dir]
end
end