Skip to content

Instantly share code, notes, and snippets.

@djberg96
Created January 19, 2012 15:09
Show Gist options
  • Save djberg96/1640512 to your computer and use it in GitHub Desktop.
Save djberg96/1640512 to your computer and use it in GitHub Desktop.
Trouble with Rubinius and test-unit gem
# Works fine with MRI and JRuby.
# Rubinius doesn't seem to pick up the gem, blows up with an error.
require 'rubygems'
gem 'test-unit'
require 'test/unit'
class TC_Foo < Test::Unit::TestCase
test "test-unit 2 works as expected" do
assert_true(1 == 1)
end
end
# I definitely have the gem installed
>rbx -S gem list
*** LOCAL GEMS ***
rubygems-update (1.8.15)
test-unit (2.4.5)
# Here's my environment
>rbx -S gem env
RubyGems Environment:
- RUBYGEMS VERSION: 1.8.15
- RUBY VERSION: 1.8.7 (yyyy-mm-dd patchlevel 0) [x86_64-apple-darwin10.8.0]
- INSTALLATION DIRECTORY: /opt/test/rubinius/2.0/gems/1.8
- RUBYGEMS PREFIX: /opt/test/rubinius/2.0
- RUBY EXECUTABLE: /opt/test/rubinius/2.0/bin/rbx
- EXECUTABLE DIRECTORY: /opt/test/rubinius/2.0/gems/1.8/bin
- RUBYGEMS PLATFORMS:
- ruby
- x86_64-darwin-10
- x86_64-rubinius-2.0
- GEM PATHS:
- /opt/test/rubinius/2.0/gems/1.8
- /Users/djberge/.gem/rbx/1.8
- GEM CONFIGURATION:
- :update_sources => true
- :verbose => true
- :benchmark => false
- :backtrace => false
- :bulk_threshold => 1000
- REMOTE SOURCES:
- http://rubygems.org/
# Here's the error that indicates it's trying to use test-unit in the stdlib
>rbx test.rb
An exception occurred running test.rb
method 'test': given 1, expected 3 (ArgumentError)
Backtrace:
TC_Foo.__class_init__ (TC_Foo) at test.rb:6
Object#__script__ at test.rb:5
Rubinius::CodeLoader#load_script at kernel/delta/codeloader.rb:67
Rubinius::CodeLoader.load_script at kernel/delta/codeloader.rb:109
Rubinius::Loader#script at kernel/loader.rb:630
Rubinius::Loader#main at kernel/loader.rb:834
Loaded suite test
Started
F
Finished in 0.00357 seconds.
1) Failure:
default_test(TC_Foo)
[kernel/bootstrap/array.rb:68:in `each'
kernel/bootstrap/array.rb:68:in `each']:
No tests were specified.
1 tests, 1 assertions, 1 failures, 0 errors
@djberg96
Copy link
Author

The output of $: after the "gem 'test-unit'" on line 5:

["/opt/test/rubinius/2.0/lib/18", "/opt/test/rubinius/2.0/gems/1.8/gems/test-unit-2.4.5/lib", "/opt/test/rubinius/2.0/site", "/opt/test/rubinius/2.0/site/x86_64-darwin10.8.0", "/opt/test/rubinius/2.0/vendor", "/opt/test/rubinius/2.0/vendor/x86_64-darwin10.8.0", "/opt/test/rubinius/2.0/lib", "."]

@djberg96
Copy link
Author

Here's the output of $: when using MRI:

["/usr/local/lib/ruby/gems/1.8/gems/test-unit-2.4.5/lib", "/usr/local/lib/ruby/site_ruby/1.8", "/usr/local/lib/ruby/site_ruby/1.8/i686-darwin10.8.0", "/usr/local/lib/ruby/site_ruby", "/usr/local/lib/ruby/vendor_ruby/1.8", "/usr/local/lib/ruby/vendor_ruby/1.8/i686-darwin10.8.0", "/usr/local/lib/ruby/vendor_ruby", "/usr/local/lib/ruby/1.8", "/usr/local/lib/ruby/1.8/i686-darwin10.8.0", "."]

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment