I've put this information into a pastie, but repeated it here (pastie link http://pastie.org/private/4vprzwhllqv35egrf8jzwg )
Th开发者_JAVA百科e problem showed up in my own project, but I have no idea what i'm doing wrong: here's the full output:
$ rake test
(in /Users/me/Projects/version-three)
/Users/me/.rvm/rubies/ruby-1.9.2-rc2/bin/ruby -I"lib:test" "/Users/me/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake/rake_test_loader.rb" "./test/test_a.rb" "./test/test_configuration.rb" "./test/test_generator_base.rb" "./test/test_lazy_attr_accessor.rb" "./test/test_output_spokesman.rb" "./test/test_path_for_executable.rb"
Test run options: --seed 28629
Loaded suite /Users/me/.rvm/gems/ruby-1.9.2-rc2/gems/rake-0.8.7/lib/rake/rake_test_loader
Started
...............Could not find task "./test/test_a.rb".
......
Finished in 0.014943 seconds.
21 tests, 19 assertions, 0 failures, 0 errors, 0 skips
Test run options: --seed 28629
As you can see there is an erroneous Could not find task "./test/test_a.rb"
- I added this file simply to stop it choking on my first file with important tests!
The Rakefile couldn't be simpler, just this:
require 'rake/testtask'
task :default => :test
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList['./test/test_*.rb']
t.verbose = true
end
I'm using the following versions of relevant tools, as you can see I'm using RVM and I see the same problem on Ruby 1.8.7.
$ rake --version
rake, version 0.8.7
$ ruby --version
ruby 1.9.2dev (2010-07-11 revision 28618) [x86_64-darwin10.4.0]
$ rvm --version
rvm 0.1.43 by Wayne E. Seguin (wayneeseguin@gmail.com) [http://rvm.beginrescueend.com/]
It appears this problem comes up when requiring Thor
- it's a rake replacement, supposedly - perhaps I need to look into it more, but one of my tests was testing a Thor backed generator.
I'll look into what's going on more thoroughly!
I have identified the (foolish) problem, the message is actually coming out of Thor, I had a line that read like:
def test_banner_if_starting_generator_with_no_args
::Cli::Generator.start(ARGV)
# Test the banner output here...
end
And of course ARGV
was being set to the first file in the list assembled by Rake's FileList and passed to the test loader.
Sorry for wasting anyone's time who looked into this.
Solution: stub the ARGV
to []
since that's effectively what I'm testing!
精彩评论