[rspec-users] Canonical way to generate RSpec HTML report in Rails app

Johan Sørensen johan at johansorensen.com
Thu Jul 26 13:06:45 EDT 2007

On Jul 26, 2007, at 6:54 PM, Peter Marklund wrote:

> Hi Don!
> Thanks, that looks nice. For now I'm just using this bash alias:
> alias specdoc='spec spec -f h:spec/spec_report.html; open spec/
> spec_report.html'
> However, I guess it's nicer to have this be a Rake task so that it
> can be used by the whole development team. I was looking for an easy
> way to pass options on from rake to the spec command, but I'm sort of
> starting to get the feeling that sometimes it's better to invoke the
> spec command directly instead of going via rake just as is the case
> with Capistrano and the cap command.

Maybe something like (untested, but it's along the lines of my other  

   require "spec/rake/spectask"

   Spec::Rake::SpecTask.new("htmlspecdocs") do |t|
     t.spec_files = FileList["spec/**/*_spec.rb"]
     t.spec_opts = [
       "--require", File.dirname(__FILE__) + "/../../spec/spec_helper",
       # maybe just "h" is enough instead of the classpath here
       "--format", "Spec::Runner::Formatter::HtmlFormatter:doc/ 


More information about the rspec-users mailing list