Hello to every one,
I’m writing an application and using rspec to test it. I like very much
html output, since it allows me to look at it and see how something is
supposed to work. The only problem is that the list of example is
growing to a size that makes looking for a particular example a bit
consuming. So I got the idea to split the output into several files.
a_spec.rb -> a_results.html
b_spec.rb -> b_results.html
Since I put all the specs related to a class in a single spec file, this
allow me to have a clear overview of the class and to be able to locate
quickly the example I’m looking for. The only problem is that, as far as
know, rspec doesn’t provide similar features.
So, I decided to try and write a custom rspec formatter which does what
described above. Before I start coding, however, I’d like to know the
to some questions:
- is there any reason my idea is not a good one?
- has something like this already been implemented? I searched google,
mailing list and the ruby mailing list, but found nothing
- what’s the best way for a formatter to access the name of the file an
example comes from? Looking at the RDoc documentation, the only way I
to use the Spec::Example::ExampleMethods#implementation_backtrace, which
contains the filename and line of the example in its first entry. Is
reliable? Is there a better way?
Thanks in advance