[rspec-users] Upgrade problems/questions regarding RSpec 1.3.0 to 2.0.1

Jarmo Pertman jarmo.p at gmail.com
Fri Nov 5 16:29:55 EDT 2010


On Nov 5, 1:52 pm, David Chelimsky <dchelim... at gmail.com> wrote:
> > 4) In 1.x i modified ExampleGroup's description in my html formatter
> > to have some additional information in it like timestamp. I did it in
> > example_group_started where the passed variable example_group was an
> > instance of the ExampleGroup. In 2.x this is just a class name. How
> > can i accomplish the similar functionality?
>
> You can write a custom subclass of the HtmlFormatter and add whatever you like.

Since i don't consider this as an issue to be reported at GitHub
rather than a new way to do things then i just want to know how should
i do this. I understand that i can write a custom subclass of the
HtmlFormatter and do there whatever i like. This is the actual case -
i already have an subclass of HtmlFormatter, but the problem is that
super class is acting differently than it was in 1.x.

In HtmlFormatter#example_group_started a parameter called
example_group was an actual instance of the current ExampleGroup in
1.x thus i were able to modify it's description so it would have
additional information in my custom html formatter report. In 2.x the
parameter example_group is not anymore an instance of an ExampleGroup,
but just a class constant for runtime ExampleGroup class, thus there's
nothing useful to do with that parameter anymore. How should/could i
modify the description now? I'm afraid that in
HtmlFormatter#example_started where i could access the ExampleGroup
from the Example instance it's already too late since ExampleGroup
description might be already flushed to the report. Haven't tried that
yet though.

Hopefully you understand my concern better now.

Jarmo Pertman


More information about the rspec-users mailing list