Project

General

Profile

Bug #4407

rubygems test should use require_relative

Added by sorah (Sorah Fukumori) almost 9 years ago. Updated over 8 years ago.

Status:
Closed
Priority:
Normal
Target version:
-
ruby -v:
ruby 1.9.3dev (2011-02-15 trunk 30885) [x86_64-darwin10.6.0]
Backport:
[ruby-core:35285]

Description

=begin
hi,

rubygem's some tests should use require_relative.

Patch is here

diff --git test/rubygems/test_gem_format.rb test/rubygems/test_gem_format.rb
index f964cab..b808398 100644
--- test/rubygems/test_gem_format.rb
+++ test/rubygems/test_gem_format.rb
@@ -5,7 +5,11 @@
######################################################################

require 'rubygems/package/tar_test_case'
-require 'test/rubygems/simple_gem'
+if respond_to?(:require_relative)

  • require_relative 'simple_gem' +else
  • require "#{File.dirname(FILE)}/simple_gem" +end require 'rubygems/format'

class TestGemFormat < Gem::Package::TarTestCase
diff --git test/rubygems/test_gem_validator.rb test/rubygems/test_gem_validator.rb
index aa4bd38..97491bf 100644
--- test/rubygems/test_gem_validator.rb
+++ test/rubygems/test_gem_validator.rb
@@ -5,7 +5,11 @@
######################################################################

require 'rubygems/test_case'
-require "test/rubygems/simple_gem"
+if respond_to?(:require_relative)

  • require_relative 'simple_gem' +else
  • require "#{File.dirname(FILE)}/simple_gem" +end require 'rubygems/validator'

class TestGemValidator < Gem::TestCase
=end


Related issues

Is duplicate of Ruby master - Bug #4395: Can't require test/rubygems/simple_gem when tests run in different directoryClosed02/14/2011Actions

History

#1

Updated by zenspider (Ryan Davis) almost 9 years ago

=begin

On Feb 17, 2011, at 05:13 , Shota Fukumori wrote:

require 'rubygems/package/tar_test_case'
-require 'test/rubygems/simple_gem'
+if respond_to?(:require_relative)

  • require_relative 'simple_gem' +else
  • require "#{File.dirname(FILE)}/simple_gem" +end

I've removed the "test/" part... thanks for pointing that out.

But, why should we replace 1 clean line of code with 5 much uglier lines of code?

=end

#2

Updated by drbrain (Eric Hodel) over 8 years ago

  • Status changed from Assigned to Closed

I think this is fixed.

Also available in: Atom PDF