# How to trace running spec

**URL:** <https://www.ruby-forum.com/t/how-to-trace-running-spec/125910>\
**Category:** RSpec\
**Created:** [January 13, 2008, 6:32pm UTC](https://www.ruby-forum.com/t/how-to-trace-running-spec/125910 "2008-01-13T18:32:06Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![hailandkill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f4b2a3/32.png) [@hailandkill](https://www.ruby-forum.com/u/hailandkill)\
**Post date:** [January 13, 2008, 6:32pm UTC](https://www.ruby-forum.com/t/how-to-trace-running-spec/125910/1 "2008-01-13T18:32:06Z")

</div>

Hey all,

I have a spec that is hanging when it is running.

How do I get the rspec runner to show what specs it’s running so I can  
which one is hanging? I am calling the runner from my rails project.

Thanks,  
Ben

---

<div class="post-metadata">

**Author:** ![hailandkill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f4b2a3/32.png) [@hailandkill](https://www.ruby-forum.com/u/hailandkill)\
**Post date:** [January 13, 2008, 10:29pm UTC](https://www.ruby-forum.com/t/how-to-trace-running-spec/125910/2 "2008-01-13T22:29:10Z")

</div>

Ben G. wrote:

> rspec-users mailing list  
> [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
> [http://rubyforge.org/mailman/listinfo/rspec-users](http://rubyforge.org/mailman/listinfo/rspec-users)

Which formatter ate you using? If you use the specdoc formatter it will  
output the specs as it goes so you can tell where it is hanging. Also,  
there is a profiling one that will list the slowest specs. Run “spec  
-h” for more info.

-Ben

---

<div class="post-metadata">

**Author:** ![hailandkill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f4b2a3/32.png) [@hailandkill](https://www.ruby-forum.com/u/hailandkill)\
**Post date:** [January 14, 2008, 3:47am UTC](https://www.ruby-forum.com/t/how-to-trace-running-spec/125910/3 "2008-01-14T03:47:40Z")

</div>

> > I have a spec that is hanging when it is running.
> > 
> > How do I get the rspec runner to show what specs it’s running so I can  
> > which one is hanging? I am calling the runner from my rails project.
> 
> Which formatter ate you using? If you use the specdoc formatter it will  
> output the specs as it goes so you can tell where it is hanging. Also,  
> there is a profiling one that will list the slowest specs. Run “spec  
> -h” for more info.

Though a formatter is no listener (or is it?), it seems to act like one.  
Steps do not tell their listeners when they are started, only when they  
are finished.

Assuming a known order, you can figure out which step hangs, but it is  
not the one listed last (it’s the one after that…)

Another reason to have s step\_started method in listeners, is to format  
(tell the customer) about a step _before_ the step is executed, such  
that  
the customer knows what will happen, instead of heard what has just  
happened.

Time to write a ticket on lighthouse?

Bye,  
Kero.

---

<div class="post-metadata">

**Author:** ![hailandkill](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/h/f4b2a3/32.png) [@hailandkill](https://www.ruby-forum.com/u/hailandkill)\
**Post date:** [January 14, 2008, 12:33pm UTC](https://www.ruby-forum.com/t/how-to-trace-running-spec/125910/4 "2008-01-14T12:33:49Z")

</div>

On Jan 14, 2008 3:47 AM, Kero van Gelder [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> Though a formatter is no listener (or is it?),  
> A formatter “listens” to events related to running of examples  
> (specs), so you can call it a “listener”.

> it seems to act like one.

It does. All our “listeners” output results in some way or another,  
which is why we call them formatters, both in our code and in the  
command line api (–formatter).

To make things even more confusing, we actually use the term  
“listener” in the story framework, but only in the code. The command  
line api still calls them formatter.

> Steps do not tell their listeners when they are started, only when they  
> are finished.

Steps is a concept you only find in the story framework. I think Ben  
was talking about RSpec “classic”.

> Assuming a known order, you can figure out which step hangs, but it is  
> not the one listed last (it’s the one after that…)
> 
> Another reason to have s step\_started method in listeners, is to format  
> (tell the customer) about a step _before_ the step is executed, such that  
> the customer knows what will happen, instead of heard what has just  
> happened.
> 
> Time to write a ticket on lighthouse?

Sure, go ahead. But I think you’re talking about a different thing  
than Ben here.

Aslak
