diff --git a/newrelic_rpm.gemspec b/newrelic_rpm.gemspec index 75dbf75f1e..e5aa0280cc 100644 --- a/newrelic_rpm.gemspec +++ b/newrelic_rpm.gemspec @@ -39,7 +39,7 @@ Gem::Specification.new do |s| 'homepage_uri' => 'https://newrelic.com/ruby' } - reject_list = File.read('./.build_ignore').split("\n") + reject_list = File.read(File.expand_path('../.build_ignore', __FILE__)).split("\n") file_list = `git ls-files -z`.split("\x0").reject { |f| reject_list.any? { |rf| f.start_with?(rf) } } # test/agent_helper.rb is a requirement for the NewRelic::Agent.require_test_helper public API test_helper_path = 'test/agent_helper.rb' diff --git a/test/new_relic/gemspec_files_test.rb b/test/new_relic/gemspec_files_test.rb index 867b54d812..2cb6be605d 100644 --- a/test/new_relic/gemspec_files_test.rb +++ b/test/new_relic/gemspec_files_test.rb @@ -7,14 +7,16 @@ class GemspecFilesTest < Minitest::Test def test_the_test_agent_helper_is_shipped_in_the_gem_files skip if defined?(Rails::VERSION) - - agent_helper_file = 'test/agent_helper.rb' + skip 'Gemspec test requires a newer version of Rubygems' unless Gem.respond_to?(:open_file) gem_spec_file_path = File.expand_path('../../../newrelic_rpm.gemspec', __FILE__) - gem_spec = Gem::Specification.load(gem_spec_file_path) + Dir.chdir(File.dirname(gem_spec_file_path)) do + gem_spec = eval(Gem.open_file(gem_spec_file_path, 'r:UTF-8:-', &:read)) - assert_equal('newrelic_rpm', gem_spec.name) - assert_includes(gem_spec.files, agent_helper_file) + assert gem_spec, "Failed to parse '#{gem_spec_file_path}'" + assert_equal('newrelic_rpm', gem_spec.name) + assert_includes(gem_spec.files, 'test/agent_helper.rb') + end end end