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

Don Petersen don at donpetersen.net
Thu Jul 26 12:37:33 EDT 2007

There might be a "better" way to do it, but I basically ripped off  
the builtin spec:doc Rake task almost verbatim and made a custom task  
in my Rails app for generating the HTML report.  This isn't anything  
magical, but you should be able to drop a file called  
"whatever_you_want.rake" in your lib/tasks with the contents  
provided, and it'll give you a "spec doc:html_doc" task that will  
generate the report and save it to "spec/report.html".

Here's the task code: http://pastie.textmate.org/82520

Like a said, complete rip off of another builtin task.  Notice that  
it's executing as a dry-run, so it's not actually executing the  
specs, just generating the report of what specs you have.  Take that  
out and it will actually run them and report accordingly...


On Jul 26, 2007, at 11:24 AM, Peter Marklund wrote:

> Hi!
> I was just wondering how you typically generate a spec HTML report in
> a Rails app. Currently I'm doing something like this:
> spec spec -f h:spec/spec_report.html
> But that seems sort of clumsy and I would have thought that there was
> a rake task for it. Have I overlooked something?
> Thanks!
> Peter
> ----------------------------
> Peter Marklund
> Garvar Lundins Gränd 7
> 11220 Stockholm
> Sweden
> Mobile Phone: +46-(0)70-4164857
> Home Phone: +46-(0)8-50091315
> Skype: peter_marklund
> IM: AIM - petermarklund, MSN - peter_marklund at hotmail.com, Yahoo -
> peter_marklund2002
> http://marklunds.com
> ----------------------------
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

More information about the rspec-users mailing list