[rspec-users] newb q: Can story steps report a view rendering error?
philodespotos at gmail.com
Wed Apr 2 20:31:38 EDT 2008
On Wed, Apr 2, 2008 at 6:09 PM, Tim Haines <tmhaines at gmail.com> wrote:
> I have a When step that calls get game_url. It turns out that calling this
> page is resulting in a render error, which explains my failing Then steps.
> It would help me if the story told me there was a problem rendering the
> response. Is there any way to get the story steps to automatically raise an
> error if such a problem occurs?
> For now I can add response.code.should == "200" or something similar..
I just rely on test.log, inside of which you will find the typical
stacktrace produced by errors that occur while rendering a template.
So that will explain the problem; to catch the explosion before your
stories move on, you are right that you have to check the response
code. Your code check, or the equivalent 'response.should be_success',
should suffice. webrat, for example, wraps its requests in a method
'request_page()', and after every request it calls 'assert_response
:success' so that the story will fail fast.
More information about the rspec-users