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

Peter Marklund peter_marklund at fastmail.fm
Thu Jul 26 12:54:12 EDT 2007


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.

Cheers

Peter

On Jul 26, 2007, at 6:37 PM, Don Petersen wrote:

> 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...
>
> Don
>
> 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
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users



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





More information about the rspec-users mailing list