0
votes

I'm really new to ruby. I'm starting to play following this guide for setting up ruby, rvm, update all my mac to current version, without any problem. So I installed test-unit gem and try some TDD script. Running the test nothing happen. So I run ruby with "-d" option and this happen.

Exception 'LoadError' at /Users/BlackSheep/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems.rb:1222 - cannot load such file -- rubygems/defaults/operating_system

Exception 'LoadError' at /Users/BlackSheep/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems.rb:1231 - cannot load such file -- rubygems/defaults/ruby

Exception `LoadError' at /Users/BlackSheep/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/core_ext/kernel_require.rb:54 - cannot load such file -- test/unit

Exception 'NoMethodError' at /Users/BlackSheep/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1984 - undefined method `to_ary' for #

Exception 'NoMethodError' at /Users/BlackSheep/.rvm/rubies/ruby-2.2.0/lib/ruby/site_ruby/2.2.0/rubygems/specification.rb:1984 - undefined method 'to_ary' for #

what could be the problem?

Versions:

  • Ruby: 2.2.0p0 (2014-12-25 revision 49005) [x86_64-darwin14]
  • Rvm: 1.26.10
  • Gem: 2.4.6

Edit: I've downgrade to version 2.0.0 and it works fine. So test-unit gem is not made for current ruby version?

1
I just upgraded to ruby 2.1.5 and got a similar error. With unit-test 3.0.9 the error disappeared. Can you also try unit test ~> 3?knut
I moved to rspec. Happily.Korsmakolnikov

1 Answers

1
votes

Up to 2.1, Ruby shipped with test/unit, but as of 2.2, it's been removed.

It's still available as a gem: https://github.com/test-unit/test-unit/. From the README: "Test::Unit 1.2.3 is the original Test::Unit, taken straight from the ruby distribution. It is being distributed as a gem to allow tool builders to use it as a stand-alone package. (The test framework in ruby is going to radically change very soon)."

If you make sure the test-unit gem is install (either gem install test-unit or add gem 'test-unit' to your Gemfile) it should solve the problem.