Pat Maddox
2007-Apr-09 05:37 UTC
[rspec-users] RCov results seem to include the spec files
I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and decided to add it to my project. My rakefile looks like this: require "rake" require "spec/rake/spectask" desc "Run all specs with RCov" Spec::Rake::SpecTask.new("spec:rcov") do |t| t.spec_files = FileList["spec/**/*_spec.rb"] t.rcov = true end When I run rake spec:rcov, it runs the specs using RCov and generates the reports, but it''s including all my spec files as well. At the very bottom I''ll see stuff like spec/models/user_spec.rb 89 73 100.0% it even includes spec_helper.rb! I don''t really care to know that my specs are covered :) Here''s the command that''s being run as a result of the rake task: /usr/local/bin/ruby -I"/usr/local/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" -S rcov --exclude lib\/spec,bin\/spec,config\/boot.rb -o "coverage" "/usr/local/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" -- "spec/controllers/books_controller_spec.rb" "spec/controllers/feedback_controller_spec.rb" "spec/controllers/stack_controller_spec.rb" "spec/controllers/users_controller_spec.rb" "spec/helpers/books_helper_spec.rb" "spec/models/book_spec.rb" "spec/models/user_spec.rb" rspec 0.8.2, rcov 0.8.0.2 I noticed that the example output at http://rspec.rubyforge.org/coverage/index.html doesn''t seem to share this. So how can I make rcov ignore the spec files themselves? Pat
Scott Taylor
2007-Apr-09 07:29 UTC
[rspec-users] RCov results seem to include the spec files
I''m getting a ton of errors when using that... Here is one of my specs: describe "GET /users/1/terms" do controller_name :terms def do_get get :index, :user_id => 1 end it "should be successful" do do_get response.should be_success end ... end and the response from rcov: 1) NoMethodError in ''GET /users/1/terms should render index'' undefined method `should_render'' for #<TermsController:0x39d7b20> ./spec/controllers/terms_controller_spec.rb:43: Any ideas? Scott On Apr 9, 2007, at 1:37 AM, Pat Maddox wrote:> > require "rake" > require "spec/rake/spectask" > > desc "Run all specs with RCov" > Spec::Rake::SpecTask.new("spec:rcov") do |t| > t.spec_files = FileList["spec/**/*_spec.rb"] > t.rcov = true > end
Scott Taylor
2007-Apr-09 07:34 UTC
[rspec-users] RCov results seem to include the spec files
oops. wrong spec included. it should be: it "should render index" do controller.should_render(:index) do_get end On Apr 9, 2007, at 3:29 AM, Scott Taylor wrote:> > I''m getting a ton of errors when using that... > > Here is one of my specs: > > describe "GET /users/1/terms" do > > controller_name :terms > > def do_get > get :index, :user_id => 1 > end > > it "should be successful" do > do_get > response.should be_success > end > > ... > end > > and the response from rcov: > > 1) > NoMethodError in ''GET /users/1/terms should render index'' > undefined method `should_render'' for #<TermsController:0x39d7b20> > ./spec/controllers/terms_controller_spec.rb:43: > > Any ideas? > > Scott > > > > On Apr 9, 2007, at 1:37 AM, Pat Maddox wrote: > >> >> require "rake" >> require "spec/rake/spectask" >> >> desc "Run all specs with RCov" >> Spec::Rake::SpecTask.new("spec:rcov") do |t| >> t.spec_files = FileList["spec/**/*_spec.rb"] >> t.rcov = true >> end > > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky
2007-Apr-09 11:14 UTC
[rspec-users] RCov results seem to include the spec files
On 4/9/07, Pat Maddox <pergesu at gmail.com> wrote:> I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and > decided to add it to my project. My rakefile looks like this: > > require "rake" > require "spec/rake/spectask" > > desc "Run all specs with RCov" > Spec::Rake::SpecTask.new("spec:rcov") do |t| > t.spec_files = FileList["spec/**/*_spec.rb"] > t.rcov = true > endTry this: Spec::Rake::SpecTask.new("spec:rcov") do |t| t.spec_files = FileList["spec/**/*_spec.rb"] t.rcov = true t.rcov_opts = [''--exclude'', "spec"] end David> When I run rake spec:rcov, it runs the specs using RCov and generates > the reports, but it''s including all my spec files as well. > > At the very bottom I''ll see stuff like > spec/models/user_spec.rb 89 73 100.0% > > it even includes spec_helper.rb! > > I don''t really care to know that my specs are covered :) > > Here''s the command that''s being run as a result of the rake task: > /usr/local/bin/ruby > -I"/usr/local/lib/ruby/gems/1.8/gems/rspec-0.8.2/lib" -S rcov > --exclude lib\/spec,bin\/spec,config\/boot.rb -o "coverage" > "/usr/local/lib/ruby/gems/1.8/gems/rspec-0.8.2/bin/spec" -- > "spec/controllers/books_controller_spec.rb" > "spec/controllers/feedback_controller_spec.rb" > "spec/controllers/stack_controller_spec.rb" > "spec/controllers/users_controller_spec.rb" > "spec/helpers/books_helper_spec.rb" "spec/models/book_spec.rb" > "spec/models/user_spec.rb" > > rspec 0.8.2, rcov 0.8.0.2 > > I noticed that the example output at > http://rspec.rubyforge.org/coverage/index.html doesn''t seem to share > this. So how can I make rcov ignore the spec files themselves? > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >
David Chelimsky
2007-Apr-09 11:29 UTC
[rspec-users] RCov results seem to include the spec files
On 4/9/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 4/9/07, Pat Maddox <pergesu at gmail.com> wrote: > > I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and > > decided to add it to my project. My rakefile looks like this: > > > > require "rake" > > require "spec/rake/spectask" > > > > desc "Run all specs with RCov" > > Spec::Rake::SpecTask.new("spec:rcov") do |t| > > t.spec_files = FileList["spec/**/*_spec.rb"] > > t.rcov = true > > end > > Try this: > > Spec::Rake::SpecTask.new("spec:rcov") do |t| > t.spec_files = FileList["spec/**/*_spec.rb"] > t.rcov = true > t.rcov_opts = [''--exclude'', "spec"] > end > > DavidFYI - I added this to docs for 0.9.
Pat Maddox
2007-Apr-09 17:14 UTC
[rspec-users] RCov results seem to include the spec files
On 4/9/07, David Chelimsky <dchelimsky at gmail.com> wrote:> On 4/9/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 4/9/07, Pat Maddox <pergesu at gmail.com> wrote: > > > I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and > > > decided to add it to my project. My rakefile looks like this: > > > > > > require "rake" > > > require "spec/rake/spectask" > > > > > > desc "Run all specs with RCov" > > > Spec::Rake::SpecTask.new("spec:rcov") do |t| > > > t.spec_files = FileList["spec/**/*_spec.rb"] > > > t.rcov = true > > > end > > > > Try this: > > > > Spec::Rake::SpecTask.new("spec:rcov") do |t| > > t.spec_files = FileList["spec/**/*_spec.rb"] > > t.rcov = true > > t.rcov_opts = [''--exclude'', "spec"] > > end > > > > David > > FYI - I added this to docs for 0.9. > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >Hey David, Thanks for the info. For Rails apps, I use t.rcov_opts = [''--exclude'', "spec", "--exclude", "config"] because it doesn''t make much sense to include the config files either. Thanks again, Pat
Michael Trier
2007-Apr-09 17:55 UTC
[rspec-users] RCov results seem to include the spec files
What about the test directory as well for those of us that are still migrating things over. Michael railsconsulting.com On Apr 9, 2007, at 1:14 PM, Pat Maddox wrote:> On 4/9/07, David Chelimsky <dchelimsky at gmail.com> wrote: >> On 4/9/07, David Chelimsky <dchelimsky at gmail.com> wrote: >>> On 4/9/07, Pat Maddox <pergesu at gmail.com> wrote: >>>> I saw the RCov page at http://rspec.rubyforge.org/tools/ >>>> rcov.html and >>>> decided to add it to my project. My rakefile looks like this: >>>> >>>> require "rake" >>>> require "spec/rake/spectask" >>>> >>>> desc "Run all specs with RCov" >>>> Spec::Rake::SpecTask.new("spec:rcov") do |t| >>>> t.spec_files = FileList["spec/**/*_spec.rb"] >>>> t.rcov = true >>>> end >>> >>> Try this: >>> >>> Spec::Rake::SpecTask.new("spec:rcov") do |t| >>> t.spec_files = FileList["spec/**/*_spec.rb"] >>> t.rcov = true >>> t.rcov_opts = [''--exclude'', "spec"] >>> end >>> >>> David >> >> FYI - I added this to docs for 0.9. >> _______________________________________________ >> rspec-users mailing list >> rspec-users at rubyforge.org >> http://rubyforge.org/mailman/listinfo/rspec-users >> > > Hey David, > > Thanks for the info. > > For Rails apps, I use > t.rcov_opts = [''--exclude'', "spec", "--exclude", "config"] > > because it doesn''t make much sense to include the config files either. > > Thanks again, > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users
David Chelimsky
2007-Apr-09 18:01 UTC
[rspec-users] RCov results seem to include the spec files
On 4/9/07, Pat Maddox <pergesu at gmail.com> wrote:> On 4/9/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > On 4/9/07, David Chelimsky <dchelimsky at gmail.com> wrote: > > > On 4/9/07, Pat Maddox <pergesu at gmail.com> wrote: > > > > I saw the RCov page at http://rspec.rubyforge.org/tools/rcov.html and > > > > decided to add it to my project. My rakefile looks like this: > > > > > > > > require "rake" > > > > require "spec/rake/spectask" > > > > > > > > desc "Run all specs with RCov" > > > > Spec::Rake::SpecTask.new("spec:rcov") do |t| > > > > t.spec_files = FileList["spec/**/*_spec.rb"] > > > > t.rcov = true > > > > end > > > > > > Try this: > > > > > > Spec::Rake::SpecTask.new("spec:rcov") do |t| > > > t.spec_files = FileList["spec/**/*_spec.rb"] > > > t.rcov = true > > > t.rcov_opts = [''--exclude'', "spec"] > > > end > > > > > > David > > > > FYI - I added this to docs for 0.9. > > _______________________________________________ > > rspec-users mailing list > > rspec-users at rubyforge.org > > http://rubyforge.org/mailman/listinfo/rspec-users > > > > Hey David, > > Thanks for the info. > > For Rails apps, I use > t.rcov_opts = [''--exclude'', "spec", "--exclude", "config"]You can also do it w/ a single --exclude and a list of comma separated vals: t.rcov_opts = [''--exclude'', "spec, config"]> > because it doesn''t make much sense to include the config files either. > > Thanks again, > > Pat > _______________________________________________ > rspec-users mailing list > rspec-users at rubyforge.org > http://rubyforge.org/mailman/listinfo/rspec-users >