views:

284

answers:

2

The following output appears after running some rake tasks:

Loaded suite /usr/bin/rake
Started

Finished in 0.00042 seconds.

0 tests, 0 assertions, 0 failures, 0 errors

This output is not useful or necessary for tasks not related to testing. I'd like to prevent it from appearing. I would assume it stems from requiring a certain file or including a certain module.

Updated: It appears that I was wrong and this does come up during some of the tasks built into Rails. Here is the output of fixtures being loaded with --trace.

$ rake db:fixtures:load --trace

** Invoke db:fixtures:load (first_time)
** Invoke environment (first_time)
** Execute environment
** Execute db:fixtures:load
Loaded suite /usr/bin/rake
Started

Finished in 0.000255 seconds.

0 tests, 0 assertions, 0 failures, 0 errors
+1  A: 

First check the test pattern for your Rake::TestTask. Should be something like 'test/**/*_test.rb'.

For whatever reason, Test::Unit is trying to find tests in the /usr/bin/rake executable, which probably means you've got a bogus pattern somewhere.

Anytime you have problems like this, you want to run rake with --trace to see what tasks and task dependencies are being run, and in which order. If updating the pattern doesn't work, please copy the output of a full run with --trace switched on into your question.

Bob Aman
One of the other developers I work with on the project recently vendored all of our gems. It's possible this is the cause? The only places that call Rake::TestTask are in the vendored gem and plugin directories.
Jared
Hard to say without the output from `--trace`. If there's no explicit test task, you probably want to write your own. The default test task won't do anything useful like check your code coverage. Regardless, if a test run occurs for any arbitrary rake task, you have messed up task dependencies, and you need to use `--trace` to debug it.
Bob Aman
Bob, I tried running a task with trace, but it didn't tell me anything more. All I discovered is that whatever it is that outputs this is running after my code completes.
Jared
Ok... class dump time. I think you're having an issue with ActiveSupport's aggressive file loader. Please list all of your models' fully qualified class names.
Bob Aman
+4  A: 

Solution can be found here:

http://github.com/thoughtbot/shoulda/issues/#issue/59

Basically don't require the shoulda gem unless it's the test environment (where test/unit would already be required).

fowlduck
Thanks for the answer fowlduck. You were correct. We had placed the config.gem call inside of environment.rb instead of environments/test.rb
Jared