Formatter writing output on different files

Hello to every one,

First of all, sorry if this message has already reached the list. I sent
it
yesterday, but since today I don’t see it in the archives, I’m resending
it.

I’m writing an application and using rspec to test it. I like very much
it’s
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
quickly
growing to a size that makes looking for a particular example a bit
time-
consuming. So I got the idea to split the output into several files.
Something
like:

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
would
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
I
know, rspec doesn’t provide similar features.

So, I decided to try and write a custom rspec formatter which does what
I
described above. Before I start coding, however, I’d like to know the
answers
to some questions:

  1. is there any reason my idea is not a good one?
  2. has something like this already been implemented? I searched google,
    this
    mailing list and the ruby mailing list, but found nothing
  3. 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
    found is
    to use the Spec::Example::ExampleMethods#implementation_backtrace, which
    contains the filename and line of the example in its first entry. Is
    this
    reliable? Is there a better way?

Thanks in advance

Stefano

On Thu, Aug 14, 2008 at 9:49 AM, Stefano C.
[email protected] wrote:

like:
described above. Before I start coding, however, I’d like to know the answers
to some questions:

  1. is there any reason my idea is not a good one?

I think it’s a good idea.

  1. has something like this already been implemented? I searched google, this
    mailing list and the ruby mailing list, but found nothing

Not to my knowledge.

  1. 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 found is
    to use the Spec::Example::ExampleMethods#implementation_backtrace, which
    contains the filename and line of the example in its first entry. Is this
    reliable? Is there a better way?

None that I know of in the current code base.

Good luck!