[rspec-users] How to dump contents produced during spec evaluation?

Alex Satrapa grail at goldweb.com.au
Sun Feb 24 18:54:11 EST 2008


In a story, I have the following happening:
     post("/resources/", 'resource' => request_attrs)
     response.should render_template('resource/new')
     response.should have_tag('*', /must have one or more X defined/)

In the ResourceController spec, I have the following happening:
     post( :create, :resource => request_attrs )
     response.should render_template('resource/new')
     response.should have_tag('*', /must have one or more X defined/)

The problem I'm having is that the story works just fine, but the  
spec claims that there are no tags matching '*' in the response.

Is there any way I can dump the contents of the response, in the hope  
that they might tip me off as to the cause of this error?

I've checked the stories, and I do not have any steps with the same  
description as the one that passes in the story but fails in the  
spec.  I've stumbled across this before, especially where a step is  
"when the user creates a new resource" - often the first one the  
story runner sees will become the definition of "when the user  
creates a new resource", and later versions have to be renamed eg:  
"when the user creates a new resource with special feature X".   
That's not happening here as far as I can tell.

Any clues on where to start looking?

Thanks
Alex



More information about the rspec-users mailing list