Conversation
…nv variable availability and get parameter passing.
There was a problem hiding this comment.
this one-liner is all that's necessary to enable rake test on 1.9.2 - still works on 1.8.7, I tested it.
There was a problem hiding this comment.
Removing this line renders me unable to run tests on 1.9.2.
The root cause of 1.9.2 not working is that Ruby removed . from the load path in 1.9.2. Changing the line to:
require File.expand_path File.join(File.dirname(FILE), 'test_helper')
fixes the include relative to the current file problem
There was a problem hiding this comment.
nope, works with 1.9.2 & ree:
$ rake test 1> /dev/null
/Users/svenkrauter/.rvm/rubies/ruby-1.9.2-p136/bin/ruby -I"lib:lib:test" "/Users/svenkrauter/.rvm/gems/ruby-1.9.2-p136@global/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/toto_test.rb"
$ rake test 1> /dev/null
/Users/svenkrauter/.rvm/rubies/ree-1.8.7-2010.02/bin/ruby -I"lib:lib:test" "/Users/svenkrauter/.rvm/gems/ree-1.8.7-2010.02/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "test/toto_test.rb"
Taking a look at the Rakefile you will notice that test.pattern is set correctly. I saw you are running a non *NIX OS, perhaps there's some adjustment needed to get going with Windows and the likes.
Cheers
5v3n
There was a problem hiding this comment.
Hi Sven,
I've looked at this again and the issue can be broadly summed up as "I'm an idiot". rake test works as expected once I stop doing stupid things as test.libs is setup correctly in the rake file.
There was a problem hiding this comment.
Hi BP,
can't copy that - you do not seem like an idiot to me.
;-)
What was the cause then? "Stupid things" is not too far on the specific side.
Cheers
Sven Kräuter | 5v3n
There was a problem hiding this comment.
I know I'm not an idiot, I've just got a terrible habit of overstating my foolishness when I realise I haven't done something that should have been obvious :D
"Stupid things" was trying to run toto_test.rb directly using ruby test/toto_test.rb instead of using the rake file. Thus lib and test weren't added to the load path which caused require errors and you can see where it all went wrong from there.
Both your and my solutions fix root problem of the current dir not being in the load path; but I'm not sure which approach is better: your is simpler, mine lets you call the test file directly but do we want to let people to do that? Should we be saying the supported way to run tests in to use rake?
There was a problem hiding this comment.
I see :-)
Two quick answers:
rake testis the way to run the tests.- 1.9.2 introduces
require_relativewhich should come to your delight ;-).
anyways, relative paths in ruby are a bit on the painful side - there's always pros & cons and to find the right thing is quite hard.
Hi!
Just made a little fix in the
test/toto_test.rbthat allowsrake testto be executed from 1.9.2 - I guess that comes quite handy for everybody running on 1.9.Cheers
Sven Kräuter | 5v3n