Forum: RSpec rspec "output which test it is running before running it"

Posted by Roger Pack (rogerdpack)
on 2010-02-25 16:31
(Received via mailing list)
I'm trying to find a spec parameter that will do something like the
following

$ spec file.spec

Spec: running "it should pass spec x"
.
Spec: running "it should pass spec y"
.


That type of thing.

The use case is that "one" of my tests is outputting some weird stuff
and I want to narrow down on which one it is easily.

Does such a thing exist?  If not would a patch for it be welcome?
Thanks.
-r
Posted by David Chelimsky (Guest)
on 2010-02-25 16:46
(Received via mailing list)
On Feb 25, 2010, at 9:29 AM, rogerdpack <rogerpack2005@gmail.com> wrote:

> I'm trying to find a spec parameter that will do something like the
> following
>
> $ spec file.spec
>
> Spec: running "it should pass spec x"
> .
> Spec: running "it should pass spec y"
> .
>
In rspec-1:

spec spec --format nested

In rspec-2;

rspec spec --format doc

HTH,
David
Posted by Matt Wynne (mattwynne)
on 2010-02-25 16:46
(Received via mailing list)
Do you mean --format specdoc ?

On 25 Feb 2010, at 15:29, rogerdpack wrote:

>
> rspec-users@rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users

cheers,
Matt

http://mattwynne.net
+447974 430184
Posted by Roger Pack (rogerdpack)
on 2010-02-25 18:44
(Received via mailing list)
> spec spec --format nested

Cool thanks!
-r
Posted by Roger Pack (rogerdpack)
on 2010-02-25 19:03
(Received via mailing list)
On Feb 25, 8:44 am, Matt Wynne <m...@mattwynne.net> wrote:
> Do you mean --format specdoc ?

Interesting.
It appears that with both specdoc and --format nested, it outputs the
test name *after* running it.  I would have expected the opposite.  Is
this expected?
Thanks.
-r
Posted by Phillip Koebbe (pkoebbe)
on 2010-02-25 19:39
(Received via mailing list)
rogerdpack wrote:
> Interesting.
> It appears that with both specdoc and --format nested, it outputs the
> test name *after* running it.  I would have expected the opposite.  Is
> this expected?
> Thanks.
> -r
>    

Yes. RSpec needs to know if the test passed or failed so it knows how to
color it.

At least, that's my layman's guess.

Peace,
Phillip
Posted by David Chelimsky (Guest)
on 2010-02-25 19:59
(Received via mailing list)
On Thu, Feb 25, 2010 at 11:47 AM, rogerdpack <rogerpack2005@gmail.com> 
wrote:
> On Feb 25, 8:44 am, Matt Wynne <m...@mattwynne.net> wrote:
>> Do you mean --format specdoc ?
>
> Interesting.
> It appears that with both specdoc and --format nested, it outputs the
> test name *after* running it.  I would have expected the opposite.  Is
> this expected?

Actually it is (now that you mention it). The reason is that each
example reports whether it passed or failed, which it clearly can't
know until it's run.

Another solution for your issue would be to write a custom formatter:
http://wiki.github.com/dchelimsky/rspec/custom-formatters

HTH,
David
Please log in before posting. Registration is free and takes only a minute.
Existing account (Switch to SSL-encrypted connection)
NEW: Do you have a Google/GoogleMail or Yahoo account? No registration required!
Log in with Google account | Log in with Yahoo account
No account? Register here.