2016-02-01 07:43:26 -05:00
|
|
|
# frozen_string_literal: true
|
2021-06-01 23:32:47 -04:00
|
|
|
require_relative "helper"
|
2007-11-10 02:48:56 -05:00
|
|
|
require "rubygems"
|
2018-10-30 23:23:30 -04:00
|
|
|
require "shellwords"
|
2007-11-10 02:48:56 -05:00
|
|
|
|
2011-01-28 18:46:47 -05:00
|
|
|
class TestConfig < Gem::TestCase
|
2007-11-10 02:48:56 -05:00
|
|
|
def test_datadir
|
2012-11-29 01:52:18 -05:00
|
|
|
util_make_gems
|
|
|
|
spec = Gem::Specification.find_by_name("a")
|
|
|
|
spec.activate
|
2017-10-07 21:32:18 -04:00
|
|
|
assert_equal "#{spec.full_gem_path}/data/a", spec.datadir
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|
|
|
|
|
2015-09-08 18:46:43 -04:00
|
|
|
def test_good_rake_path_is_escaped
|
2021-01-03 20:09:05 -05:00
|
|
|
path = Gem::TestCase.class_variable_get(:@@good_rake)
|
2018-10-30 23:23:30 -04:00
|
|
|
ruby, rake = path.shellsplit
|
|
|
|
assert_equal(Gem.ruby, ruby)
|
|
|
|
assert_match(/\/good_rake.rb\z/, rake)
|
2015-09-08 18:46:43 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
def test_bad_rake_path_is_escaped
|
2021-01-03 20:09:05 -05:00
|
|
|
path = Gem::TestCase.class_variable_get(:@@bad_rake)
|
2018-10-30 23:23:30 -04:00
|
|
|
ruby, rake = path.shellsplit
|
|
|
|
assert_equal(Gem.ruby, ruby)
|
|
|
|
assert_match(/\/bad_rake.rb\z/, rake)
|
2015-09-08 18:46:43 -04:00
|
|
|
end
|
2007-11-10 02:48:56 -05:00
|
|
|
end
|