mirror of
https://github.com/puma/puma.git
synced 2022-11-09 13:48:40 -05:00
TestBundlePruner: do not hard code directory name (#2995)
These two test would fail when running tests from a directory not named "puma", e.g. running from docker/podman like this: podman run -it --rm -v $(pwd):/app -w /app ruby:3.1.2 bash
This commit is contained in:
parent
de5bb82227
commit
03ed6c8e78
2 changed files with 3 additions and 3 deletions
|
@ -184,7 +184,7 @@ Minitest::Test.include TestSkips
|
||||||
|
|
||||||
class Minitest::Test
|
class Minitest::Test
|
||||||
|
|
||||||
REPO_NAME = ENV['GITHUB_REPOSITORY'] ? ENV['GITHUB_REPOSITORY'][/[^\/]+\z/] : 'puma'
|
PROJECT_ROOT = File.dirname(__dir__)
|
||||||
|
|
||||||
def self.run(reporter, options = {}) # :nodoc:
|
def self.run(reporter, options = {}) # :nodoc:
|
||||||
prove_it!
|
prove_it!
|
||||||
|
|
|
@ -10,7 +10,7 @@ class TestBundlePruner < Minitest::Test
|
||||||
dirs = bundle_pruner.send(:paths_to_require_after_prune)
|
dirs = bundle_pruner.send(:paths_to_require_after_prune)
|
||||||
|
|
||||||
assert_equal(2, dirs.length)
|
assert_equal(2, dirs.length)
|
||||||
assert_match(%r{#{REPO_NAME}/lib$}, dirs[0]) # lib dir
|
assert_equal(File.join(PROJECT_ROOT, "lib"), dirs[0]) # lib dir
|
||||||
assert_match(%r{puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
|
assert_match(%r{puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
|
||||||
refute_match(%r{gems/minitest-[\d.]+/lib$}, dirs[2])
|
refute_match(%r{gems/minitest-[\d.]+/lib$}, dirs[2])
|
||||||
end
|
end
|
||||||
|
@ -21,7 +21,7 @@ class TestBundlePruner < Minitest::Test
|
||||||
dirs = bundle_pruner([], ['minitest']).send(:paths_to_require_after_prune)
|
dirs = bundle_pruner([], ['minitest']).send(:paths_to_require_after_prune)
|
||||||
|
|
||||||
assert_equal(3, dirs.length)
|
assert_equal(3, dirs.length)
|
||||||
assert_match(%r{#{REPO_NAME}/lib$}, dirs[0]) # lib dir
|
assert_equal(File.join(PROJECT_ROOT, "lib"), dirs[0]) # lib dir
|
||||||
assert_match(%r{puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
|
assert_match(%r{puma-#{Puma::Const::PUMA_VERSION}$}, dirs[1]) # native extension dir
|
||||||
assert_match(%r{gems/minitest-[\d.]+/lib$}, dirs[2]) # minitest dir
|
assert_match(%r{gems/minitest-[\d.]+/lib$}, dirs[2]) # minitest dir
|
||||||
end
|
end
|
||||||
|
|
Loading…
Add table
Reference in a new issue