[rspec-users] Using Rcov with rspec_on_rails

Scott Taylor mailing_lists at railsnewbie.com
Wed Jun 13 15:13:56 EDT 2007


Running the defualt task which comes with rspec gives me the following:

=======================================================
euclid% rake spec:rcov
(in /Users/smtlaissezfaire/Sites/rails/changelog)
................................*..*..*...................*............. 
...................................

Finished in 5.751487 seconds

107 examples, 0 failures, 4 not implemented

No file to analyze was found. All the files loaded by rcov matched  
one of the
following expressions, and were thus ignored:
[/\A\/opt\/local\/lib/,
/\btc_[^.]*.rb/,
/_test\.rb\z/,
/\btest\//,
/\bvendor\//,
/\A\/opt\/local\/lib\/ruby\/gems\/1\.8\/gems\/rcov\-0\.8\.0\.2\/lib\/ 
rcov\/report\.rb\z/,
/spec/,
/\bvendor\//,
/\bconfig\//,
/\benvironment\//]

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).

=======================================================


Is there something obvious that I'm not doing?  I have the latest  
rcov gem installed, as well as the rails_rcov gem installed.

Thanks for the help,

Scott



More information about the rspec-users mailing list