<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><div><div>On Jul 9, 2008, at 5:52 PM, Rick DeNatale wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite">At work we've got a rather complex app with both specs and tests. Our default rake task runs all our our tests and specs.&nbsp; We've also got separate rake tasks to run groups of tests and specs in the various subdirectories.&nbsp; The default task simply lists all the individual tasks as pre-reqs.<br> <br>We do a lot of branching and merging, so we really want to run all of the tests and specs to see all failures.<br><br>We just realized that Rspec is aborting rake when a spec fails or errors in an individual rake task.&nbsp; I've been trying to fix this to no avail.&nbsp; I notice that SpecTask has an attribute accessor fail_on_error which looks like it SHOULD prevent terminating rake if it's set to false.&nbsp; So I tried that and it doesn't seem to work.&nbsp; Here's our projects lib/tasks/spec.rake, any ideas?<br> <br><br>def spec_tasks<br>&nbsp; %w{spec:controllers spec:models spec:helpers spec:views spec:lib} + spec_subdirs.map {|t| "spec:#{t}"}<br>end<br><br>begin<br>&nbsp; require RAILS_ROOT + '/vendor/plugins/rspec/lib/spec/rake/spectask'<br> <br>&nbsp; namespace :spec do<br>&nbsp;&nbsp; spec_subdirs.each do |task|<br>&nbsp;&nbsp;&nbsp;&nbsp; next if Rake::Task.task_defined?("spec:#{task}")</blockquote><div><br></div><div>spec:models, views, controllers and helpers are all defined already in vendor/plugins/rspec-rails/tasks/rspec.rake, so the next keyword is being invoked for all of those. You'll need to undefined them before you redefine them here.</div><div><br></div><div>spec_tasks.each {|t|&nbsp;Rake::Task::TASKS.delete t}</div><div><br></div><div>Cheers,</div><div>David</div><div><br></div><blockquote type="cite"><br>&nbsp;&nbsp;&nbsp;&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp; desc "Run the specs under spec/#{task}"<br>&nbsp;&nbsp;&nbsp;&nbsp; Spec::Rake::SpecTask.new(task) do |t|<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.fail_on_error = false<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.spec_files = FileList["spec/#{task}/*_spec.rb"]<br>&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp; <br> &nbsp;&nbsp;&nbsp;&nbsp; namespace(task) do<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Spec::Rake::SpecTask.new(:rcov) do |t|<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.fail_on_error = false<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.spec_opts = ['--options', "\"#{RAILS_ROOT}/spec/spec.opts\""]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.rcov_opts = ['--include', "\"app/#{task}/.*.rb$\""]<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.rcov = true<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; t.spec_files = FileList["spec/#{task}/*_spec.rb"]<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp;&nbsp;&nbsp; end<br>&nbsp;&nbsp; end<br>&nbsp; end<br>rescue LoadError => e<br>&nbsp; puts "Spec tasks are not available - #{e}"<br> end<br><br>namespace :spec do<br>&nbsp; desc "Run each set of specs individually"<br>&nbsp; task :each => spec_tasks<br>end<br><br clear="all"><br>-- <br>Rick DeNatale<br><br>My blog on Ruby<br><a href="http://talklikeaduck.denhaven2.com/">http://talklikeaduck.denhaven2.com/</a> _______________________________________________<br>rspec-users mailing list<br><a href="mailto:rspec-users@rubyforge.org">rspec-users@rubyforge.org</a><br>http://rubyforge.org/mailman/listinfo/rspec-users</blockquote></div><br></body></html>