Skip to content

Commit

Permalink
[rubygems/rubygems] Resolve @@project_dir from test file paths
Browse files Browse the repository at this point in the history
`Dir.pwd` may differ from the source path.  Test directories and
files should be resolved from test file paths.

rubygems/rubygems@e18e7c81b4
  • Loading branch information
nobu authored and hsbt committed Jul 24, 2019
1 parent 3a227b9 commit 99680f8
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 0 additions & 2 deletions lib/rubygems/test_case.rb
Expand Up @@ -232,8 +232,6 @@ def assert_contains_make_command(target, output, msg = nil)
undef_method :default_test if instance_methods.include? 'default_test' or
instance_methods.include? :default_test

@@project_dir = Dir.pwd.untaint unless defined?(@@project_dir)

##
# #setup prepares a sandboxed location to install gems. All installs are
# directed to a temporary directory. All install plugins are removed.
Expand Down
2 changes: 2 additions & 0 deletions test/rubygems/test_gem.rb
Expand Up @@ -17,6 +17,8 @@ class TestGem < Gem::TestCase

PLUGINS_LOADED = [] # rubocop:disable Style/MutableConstant

@@project_dir = File.expand_path('../../..', __FILE__).untaint

def setup
super

Expand Down
2 changes: 2 additions & 0 deletions test/rubygems/test_gem_command_manager.rb
Expand Up @@ -4,6 +4,8 @@

class TestGemCommandManager < Gem::TestCase

@@project_dir = File.expand_path('../../..', __FILE__).untaint

def setup
super

Expand Down

0 comments on commit 99680f8

Please sign in to comment.