summaryrefslogtreecommitdiff
path: root/test/rubygems/test_gem_commands_build_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_build_command.rb
parent4752539e3f3e563d559732c52424206bd6f12dbd (diff)
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_build_command.rb')
-rw-r--r--test/rubygems/test_gem_commands_build_command.rb34
1 files changed, 31 insertions, 3 deletions
diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb
index 5c38a1a..d4d7c29 100644
--- a/test/rubygems/test_gem_commands_build_command.rb
+++ b/test/rubygems/test_gem_commands_build_command.rb
@@ -40,10 +40,38 @@ class TestGemCommandsBuildCommand < Gem::TestCase
util_test_build_gem @gem, gemspec_file
end
- def test_execute_bad_gem
+ def test_execute_bad_spec
+ @gem.date = "2010-11-08"
+
+ gemspec_file = File.join(@tempdir, @gem.spec_name)
+
+ File.open gemspec_file, 'w' do |gs|
+ gs.write @gem.to_ruby.sub(/11-08/, "11-8")
+ end
+
+ @cmd.options[:args] = [gemspec_file]
+
+ out, err = use_ui @ui do
+ capture_io do
+ assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
+ end
+ end
+
+ assert_equal "", out
+ assert_match(/invalid date format in specification/, err)
+
+ assert_equal '', @ui.output
+ assert_equal "ERROR: Error loading gemspec. Aborting.\n", @ui.error
+ end
+
+ def test_execute_missing_file
@cmd.options[:args] = %w[some_gem]
use_ui @ui do
- @cmd.execute
+ assert_raises Gem::MockGemUi::TermError do
+ @cmd.execute
+ end
end
assert_equal '', @ui.output
@@ -67,7 +95,7 @@ class TestGemCommandsBuildCommand < Gem::TestCase
assert_equal [], output
assert_equal '', @ui.error
- gem_file = File.join @tempdir, gem.file_name
+ gem_file = File.join @tempdir, File.basename(gem.cache_file)
assert File.exist?(gem_file)
spec = Gem::Format.from_file_by_path(gem_file).spec