Hi folks. First post on these forums, after finally giving up on
railsforum.com. I recently installed the relevance fork of rcov and am
having no luck at all.
sudo gem install relevance-rcov
Easy enough. Everything seems to have worked. I can type rcov on the
command line and see the help file. But when I run the following
command:
rcov test/*.rb
I get back 0 tests, 0 assertions, 0 failures, 0 errors. Even though I
have plenty of tests sitting right in there. If I try running rcov
against a specific file, such as:
rcov test/unit/user_test.rb
…I get the following error.
No file to analyze was found. All the files loaded by rcov matched one
of the
following expressions, and were thus ignored:
[/\A\/usr\/local\/lib/,
/\btc_[^.]*.rb/,
/_test\.rb\z/,
/\btest\//,
/\bvendor\//,
/\A\/usr\/local\/lib\/ruby\/gems\/1\.8\/gems\/relevance\-rcov\-0\.8\.6\/lib\/rcov\/formatters\/base_formatter\.rb\z/]
You can solve this by doing one or more of the following:
* rename the files not to be ignored so they don't match the above
regexps
* use --include-file to give a list of patterns for files not to be
ignored
* use --exclude-only to give the new list of regexps to match against
* structure your code as follows:
test/test_*.rb for the test cases
lib/**/*.rb for the target source code whose coverage you want
making sure that the test/test_*.rb files are loading from lib/, e.g.
by
using the -Ilib command-line argument, adding
$:.unshift File.join(File.dirname(__FILE__), "..", "lib")
to test/test_*.rb, or running rcov via a Rakefile (read the RDoc
documentation or README.rake in the source distribution).
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`gem_original_require': no such file to load -- test_helper (LoadError)
from
/usr/local/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:31:in
`require'
from ./test/unit/address_test.rb:19
from
/usr/local/lib/ruby/gems/1.8/gems/relevance-rcov-0.8.6/bin/rcov:502:in
`load'
from
/usr/local/lib/ruby/gems/1.8/gems/relevance-rcov-0.8.6/bin/rcov:502
from /usr/local/bin/rcov:19:in `load'
from /usr/local/bin/rcov:19
Any ideas? Cheers.