Problems with 'gem require' and test-unit gem

Hi all,

C:>gem environment
RubyGems Environment:

  • RUBYGEMS VERSION: 1.2.0
  • RUBY VERSION: 1.8.6 (2007-09-24 patchlevel 111) [i386-mswin32]
  • INSTALLATION DIRECTORY: c:/ruby/lib/ruby/gems/1.8
  • RUBY EXECUTABLE: c:/ruby/bin/ruby.exe
  • EXECUTABLE DIRECTORY: c:/ruby/bin
  • RUBYGEMS PLATFORMS:
    • ruby
    • x86-mswin32-60
  • GEM PATHS:
    • c:/ruby/lib/ruby/gems/1.8
  • GEM CONFIGURATION:
    • :update_sources => true
    • :verbose => true
    • :benchmark => false
    • :backtrace => false
    • :bulk_threshold => 1000
  • REMOTE SOURCES:

I installed test-unit 2.0.0 as a gem, so now I’m a situation where I
want to explicitly require the gem version of test unit rather than
the one that shipped with the standard library. However, when I try
to do “gem require ‘test/unit’” I get this:

C:/Documents and Settings/djberge/workspace/win32-eventlog/test/
tc_mc.rb:10: warning: parenthesize argument(s)
for future version
c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:578:in
report_activate_error': Could not find RubyGem false (>= 0) (Gem::LoadError) from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:134:in activate’
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems.rb:49:in gem' from C:/Documents and Settings/djberge/workspace/win32- eventlog/test/tc_mc.rb:10 from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb: 27:in gem_original_require’
from c:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:
27:in require' from ./test/ts_all.rb:5 from c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake/ rake_test_loader.rb:5:in load’
from c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake/
rake_test_loader.rb:5
from c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake/
rake_test_loader.rb:5:in `each’
from c:/ruby/lib/ruby/gems/1.8/gems/rake-0.8.2/lib/rake/
rake_test_loader.rb:5
rake aborted!
Command failed with status (1): [c:/ruby/bin/ruby -w -Ilib;lib "c:/
ruby/lib…]

Where lines 9 and 10 of tc_mc.rb looks like this:

require ‘rubygems’
gem require ‘test/unit’

What’s the proper way to do this?

Thanks,

Dan

On Sep 12, 2008, at 07:08 AM, Daniel B. wrote:

gem require ‘test/unit’

What’s the proper way to do this?

require ‘rubygems’
gem ‘test-unit’
require ‘test/unit’

On Sep 12, 12:51 pm, Eric H. [email protected] wrote:

require ‘rubygems’
gem require ‘test/unit’

What’s the proper way to do this?

require ‘rubygems’
gem ‘test-unit’
require ‘test/unit’

Ah, ok.

Many thanks Eric.

Regards,

Dan