Bug #11041
closedRake test task fails with LoadError when using Ruby version 2.2.1 [Mac OSX10.9]
Description
I have just started to use RVM and have installed ruby version 2.2.1. I have a test project whose Rake test task that I was successfully executing tests with the system version (2.0.0). When I then switch to 2.2.1 via RVM, the rake_test_loader fails with a LoadError.
Initially, I thought there were 3 possible problems that cause this issue:
- different version of Ruby in use
- RVM environment is causing a problem
- there is a problem with RVM and Rake
However, I have managed to rule out 2 and 3 (if I use the previous stable version of Ruby, v2.1.5 as listed on the ruby site, then the problem goes away).
I raised a stackoverflow question about this to see if anyone knows about this, but so far no luck; see the following link:
http://stackoverflow.com/questions/29490409/why-does-rake-test-loader-rb-fail-loaderror-when-tests-run-in-rake-under-rvm-r
My test project is structured as a standard Ruby gem and the Rake file with which a launch the rake test task is:
`($LOAD_PATH << File.expand_path("../lib", FILE)).uniq!
require 'rake/testtask'
require 'rdoc/task'
require 'rubygems/package_task'
Rake::TestTask.new('test') do |t|
t.pattern = 'test/**/*tests.rb'
t.warning = true
end
task "default" => ["test"]`
I displayed the $LOAD_PATH when the tests are run under system ruby version 2.0.0 and RVM ruby version 2.2.1
$LOAD_PATH when tests fail under RVM ruby version 2.2.1:
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby/2.2.0/x86_64-darwin14",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/site_ruby",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby/2.2.0/x86_64-darwin14",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/vendor_ruby",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0",
"/Users/Sancho/.rvm/rubies/ruby-2.2.1/lib/ruby/2.2.0/x86_64-darwin14",
"/Users/Sancho/dev/git/joy/lib"
$LOAD_PATH when tests pass under 2.0.0:
"/Library/Ruby/Site/2.0.0",
"/Library/Ruby/Site/2.0.0/x86_64-darwin13",
"/Library/Ruby/Site/2.0.0/universal-darwin13",
"/Library/Ruby/Site",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/x86_64-darwin13",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby/2.0.0/universal-darwin13",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/vendor_ruby",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/x86_64-darwin13",
"/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/universal-darwin13",
"/Users/Sancho/dev/git/joy/lib"
The root of the project is /Users/Sancho/dev/git/joy/
Tests are located at /Users/Sancho/dev/git/joy/test/.../*_tests.rb
Code under test located at /Users/Sancho/dev/git/joy/lib/joy/.../*.rb
I've tested the same project against various versions of ruby (2.0.0, 2.1.1, 2.1.5) and the only version that has a problem is version 2.2.1.
Please let me know if I can provide you with more information, thanks.