Permalink
Browse files

Reworked Test Load-Path Unshifting, keeping it in TestUtil.require() …

…as much as possible.
  • Loading branch information...
1 parent 7c11418 commit 7d6dbf7c80c5f89c5cd856f094707c2cea4ec2d2 @rubyjedi committed Jun 14, 2010
View
2 test/helper.rb
@@ -2,6 +2,4 @@
require 'rubygems'
require 'test/unit/xml' ## RubyJedi
-# $:.unshift File.dirname(__FILE__) + '/../lib' # needed for TestMapper under Ruby 1.8
-
ENV['DEBUG_SOAP4R'] = 'true' ## Needed to force wsdl2ruby.rb and xsd2ruby.rb to use DEVELOPMENT soap4r libs instead of installed soap4r libs
View
4 test/soap/calc/server.cgi
@@ -1,5 +1,5 @@
-$:.unshift File.join(File.dirname(__FILE__), '/../../../lib')
-$:.unshift('.') if RUBY_VERSION.to_f >= 1.9
+$:.unshift File.expand_path(File.dirname(__FILE__)+'/../../../lib')
+$:.unshift '.' if RUBY_VERSION.to_f >= 1.9
require 'soap/rpc/cgistub'
class CalcServer < SOAP::RPC::CGIStub
View
1 test/soap/calc/test_calc.rb
@@ -1,4 +1,3 @@
-$:.unshift('.')
require 'helper'
require 'testutil'
require 'soap/wsdlDriver'
View
2 test/soap/header/server.cgi
@@ -1,4 +1,4 @@
-$:.unshift File.join(File.dirname(__FILE__), '/../../../lib')
+$:.unshift File.expand_path(File.dirname(__FILE__)+'/../../../lib')
require 'pstore'
require 'soap/rpc/cgistub'
require 'soap/header/simplehandler'
View
2 test/soap/ssl/sslsvr.rb
@@ -1,4 +1,4 @@
-$:.unshift File.join(File.dirname(__FILE__), '/../../../lib')
+$:.unshift File.expand_path(File.dirname(__FILE__)+'/../../../lib')
require 'webrick/https'
require 'logger'
require 'rbconfig'
View
18 test/testutil.rb
@@ -4,13 +4,21 @@ def self.require(dir, *features)
begin
# avoid 'already initialized constant FizzBuzz' warning
silent do
- Dir.chdir(dir) do
- $:.unshift('.') if RUBY_VERSION.to_f >= 1.9
- features.each do |feature|
- Kernel.require feature
- end
+ $:.unshift(dir)
+ features.each do |feature|
+ Kernel.require feature
end
+ $:.shift
end
+
+# Dir.chdir(dir) do
+# # $:.unshift('.') if RUBY_VERSION.to_f >= 1.9
+# features.each do |feature|
+# Kernel.require feature
+# end
+# end
+# end
+
ensure
features.each do |feature|
$".delete(feature)
View
3 test/wsdl/marshal/test_wsdlmarshal.rb
@@ -1,4 +1,3 @@
-$:.unshift File.dirname(__FILE__)
require 'helper'
require 'testutil'
require 'wsdl/parser'
@@ -31,7 +30,7 @@ def load(io)
end
end
-require 'person_org'
+TestUtil.require(File.dirname(__FILE__), 'person_org')
class Person
def ==(rhs)
View
1 test/wsdl/soap/wsdl2ruby/soapenc/test_soapenc.rb
@@ -1,4 +1,3 @@
-# $:.unshift File.dirname(__FILE__)
require 'helper'
require 'testutil'
require 'wsdl/parser'
View
6 test/xsd/xsd2ruby/test_xsd2ruby.rb
@@ -1,4 +1,3 @@
-$:.unshift File.dirname(__FILE__)
require 'helper'
require 'testutil'
require 'wsdl/xmlSchema/xsd2ruby'
@@ -23,10 +22,7 @@ def setup
gen.opt['force'] = true
gen.run
end
- # TestUtil.require(DIR, 'mysample.rb', 'mysample_mapping_registry.rb', 'mysample_mapper.rb')
- require 'mysample'
- require 'mysample_mapping_registry.rb'
- require 'mysample_mapper.rb'
+ TestUtil.require(DIR, 'mysample.rb', 'mysample_mapping_registry.rb', 'mysample_mapper.rb')
end
def teardown

0 comments on commit 7d6dbf7

Please sign in to comment.