[前][次][番号順一覧][スレッド一覧]

ruby-changes:57545

From: bronzdoc <ko1@a...>
Date: Thu, 5 Sep 2019 19:10:01 +0900 (JST)
Subject: [ruby-changes:57545] 6cacbf542c (master): [rubygems/rubygems] Test building a gem with multiple gemspec without a gem name specified

https://git.ruby-lang.org/ruby.git/commit/?id=6cacbf542c

From 6cacbf542caa9954bf760dd10a6ae3c92c9f15e4 Mon Sep 17 00:00:00 2001
From: bronzdoc <lsagastume1990@g...>
Date: Sun, 18 Aug 2019 15:19:52 -0600
Subject: [rubygems/rubygems] Test building a gem with multiple gemspec without
 a gem name specified

https://github.com/rubygems/rubygems/commit/38c72fd145

diff --git a/test/rubygems/test_gem_commands_build_command.rb b/test/rubygems/test_gem_commands_build_command.rb
index 3edd7d4..8a16038 100644
--- a/test/rubygems/test_gem_commands_build_command.rb
+++ b/test/rubygems/test_gem_commands_build_command.rb
@@ -281,6 +281,65 @@ class TestGemCommandsBuildCommand < Gem::TestCase https://github.com/ruby/ruby/blob/trunk/test/rubygems/test_gem_commands_build_command.rb#L281
     assert File.exist?(some_gem)
   end
 
+  def test_execute_multiple_gemspec_without_gem_name
+    some_gem = util_spec "some_gem"
+    another_gem = util_spec "another_gem"
+    gemspec_dir = File.join(@tempdir, "build_command_gem")
+    gemspec_file = File.join(gemspec_dir, some_gem.spec_name)
+    another_gemspec_file = File.join(gemspec_dir, another_gem.spec_name)
+
+    FileUtils.mkdir_p(gemspec_dir)
+
+    File.open(gemspec_file, "w") do |gs|
+      gs.write(some_gem.to_ruby)
+    end
+
+    File.open(another_gemspec_file, "w") do |gs|
+      gs.write(another_gem.to_ruby)
+    end
+
+    @cmd.options[:args] = []
+
+    use_ui @ui do
+      Dir.chdir(gemspec_dir) do
+        @cmd.execute
+      end
+    end
+
+    output = @ui.output.split("\n")
+    assert_equal "  Successfully built RubyGem", output.shift
+    assert_equal "  Name: another_gem", output.shift
+    assert_equal "  Version: 2", output.shift
+    assert_equal "  File: another_gem-2.gem", output.shift
+    assert_equal [], output
+
+    expected_gem = File.join(gemspec_dir, File.basename(another_gem.cache_file))
+    assert File.exist?(expected_gem)
+  end
+
+  def util_test_build_gem(gem)
+    use_ui @ui do
+      Dir.chdir @tempdir do
+        @cmd.execute
+      end
+    end
+
+    output = @ui.output.split "\n"
+    assert_equal "  Successfully built RubyGem", output.shift
+    assert_equal "  Name: some_gem", output.shift
+    assert_equal "  Version: 2", output.shift
+    assert_equal "  File: some_gem-2.gem", output.shift
+    assert_equal [], output
+
+    gem_file = File.join(@tempdir, File.basename(gem.cache_file))
+    assert File.exist?(gem_file)
+
+    spec = Gem::Package.new(gem_file).spec
+
+    assert_equal "some_gem", spec.name
+    assert_equal "this is a summary", spec.summary
+  end
+
   def util_test_build_gem(gem)
     use_ui @ui do
       Dir.chdir @tempdir do
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]