-
Notifications
You must be signed in to change notification settings - Fork 244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
rake test did not work with 1.9.2 #73
base: master
Are you sure you want to change the base?
Conversation
…nv variable availability and get parameter passing.
@@ -1,4 +1,4 @@ | |||
require 'test/test_helper' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
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.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see :-)
Two quick answers:
rake test
is the way to run the tests.- 1.9.2 introduces
require_relative
which 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.rb
that allowsrake test
to be executed from 1.9.2 - I guess that comes quite handy for everybody running on 1.9.Cheers
Sven Kräuter | 5v3n