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

David Chelimsky dchelimsky at gmail.com
Sun Feb 24 18:58:25 EST 2008


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

puts response.body

>
>  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
>
>  _______________________________________________
>  rspec-users mailing list
>  rspec-users at rubyforge.org
>  http://rubyforge.org/mailman/listinfo/rspec-users
>


More information about the rspec-users mailing list