Reputation: 23327
When I run rake spec
in my Rails project it executes all specs and then tries to run tests (like rake test
):
$ rake spec
ruby -S rspec ./spec/... #file list
# --> ... normal RSpec output
Finished in 11.11 seconds
111 examples, 0 failures, 11 pending
# --> here starts the problem <--
Run options:
# Running tests:
Finished tests in 0.000343s, 0.0000 tests/s, 0.0000 assertions/s.
0 tests, 0 assertions, 0 failures, 0 errors, 0 skips
Do you know, why it tries to run Test::Unit
tests even though I have none of them? (I don't even have test/
directory)
EDIT:
When I run other rake
commands, they do their job but then they finish with error, for example:
$ rake about
About your application's environment
Ruby version 1.9.3 (i686-linux)
RubyGems version 1.8.24
Rack version 1.4
Rails version 3.2.3
JavaScript Runtime therubyracer (V8)
Action Pack version 3.2.3
Active Support version 3.2.3
Middleware ActionDispatch::Static, Rack::Lock, Rack::Runtime, Rack::MethodOverride, ActionDispatch::RequestId, Rails::Rack::Logger, ActionDispatch::ShowExceptions, ActionDispatch::DebugExceptions, ActionDispatch::RemoteIp, ActionDispatch::Reloader, ActionDispatch::Callbacks, ActionDispatch::Cookies, ActionDispatch::Session::CookieStore, ActionDispatch::Flash, ActionDispatch::ParamsParser, ActionDispatch::Head, Rack::ConditionalGet, Rack::ETag, ActionDispatch::BestStandardsSupport
Application root /path/to/project
Environment development
path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:167:in `block in non_options': file not found: about (ArgumentError)
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:146:in `map!'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:146:in `non_options'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:207:in `non_options'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:52:in `process_args'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/minitest/unit.rb:891:in `_run'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/minitest/unit.rb:884:in `run'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:21:in `run'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:326:in `block (2 levels) in autorun'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:27:in `run_once'
from path/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/test/unit.rb:325:in `block in autorun'
Upvotes: 3
Views: 449
Reputation: 1260
Any file with require test/unit
enables an at_exit
hook which attempts to run tests.
If any file loaded from your rake task does this, the at_exit hook tries to run the test using the last part of your rake command as the name of the test to run. In the case of rake about
, it searches for a test named about
which doesn't exist.
I had the problem when I had shoulda
gem in my Gemfile. I solved it by including this in the Gemfile :
gem 'test-unit', :require => "test/unit"
Upvotes: 3