diff options
author | lukeg <luke.gru@gmail.com> | 2023-03-08 12:29:39 -0500 |
---|---|---|
committer | Hiroshi SHIBATA <hsbt@ruby-lang.org> | 2023-03-09 13:18:07 +0900 |
commit | 2ecdefab7d0f9293f2aaf047bb9c02a612d19a5a (patch) | |
tree | 8b33600aeab3d3ceb57ab255118a89259ad02250 /test | |
parent | 1658e7d96696a656d9bd0a0c84c82cde86914ba2 (diff) |
Make sure TestDefaultGems#test_validate_gemspec runs even when Dir.pwd != srcdir
For instance, when running tests in build directory like:
$ make test-all TESTOPTS="../ruby/test"
Notes
Notes:
Merged: https://github.com/ruby/ruby/pull/7478
Diffstat (limited to 'test')
-rw-r--r-- | test/ruby/test_default_gems.rb | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/test/ruby/test_default_gems.rb b/test/ruby/test_default_gems.rb index 467e5ecf83..c1c81bfec0 100644 --- a/test/ruby/test_default_gems.rb +++ b/test/ruby/test_default_gems.rb @@ -4,13 +4,20 @@ require 'rubygems' class TestDefaultGems < Test::Unit::TestCase def test_validate_gemspec - omit "git not found" unless system("git", "rev-parse", %i[out err]=>IO::NULL) srcdir = File.expand_path('../../..', __FILE__) - Dir.glob("#{srcdir}/{lib,ext}/**/*.gemspec").map do |src| - assert_nothing_raised do - raise("invalid spec in #{src}") unless Gem::Specification.load(src) + specs = 0 + Dir.chdir(srcdir) do + unless system("git", "rev-parse", %i[out err]=>IO::NULL) + omit "git not found" + end + Dir.glob("#{srcdir}/{lib,ext}/**/*.gemspec").map do |src| + specs += 1 + assert_nothing_raised do + raise("invalid spec in #{src}") unless Gem::Specification.load(src) + end end end + assert specs > 0, "gemspecs not found" end end |