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

Alex Satrapa grail at goldweb.com.au
Sun Feb 24 19:29:45 EST 2008

On 25/02/2008, at 10:58 , David Chelimsky wrote:

> On Sun, Feb 24, 2008 at 5:54 PM, Alex Satrapa  
> <grail at goldweb.com.au> wrote:
>>  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/)

>>  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?
> puts response.body

Okay, this is weird.  The result seems to indicate that the body of  
the response is the literal text, "resource/new":

My autotest results show (I've changed the name of the resource to  
> ..........resources/new
> F..............
> 1)
> 'ResourcesController on 'POST /resources/', with an invalid request  
> should generate an error message indicating that magic parts are  
> missing' FAILED
> Expected at least 1 element matching "*", found 0.
> <false> is not true.
> ./spec/controllers/resources_controller_spec.rb:138:
> script/spec:4:
> Finished in 0.753821 seconds
> 25 examples, 1 failure

Time to go through all my other specs and check that they're working  
(or breaking) the same way, to see if I can figure out what I've done  


More information about the rspec-users mailing list