Hi Rick,
Thanks for your reply.
You are right that this step is basically testing the basic actions of
a controller, and is being run as part of a story_with_steps stack.
The step itself is definitely being hit, because I have a:
response.should have_tag('li', @title)
...in the same step, and that is working nicely.

This step is called right after clicking an Update button, which is a
standard rails scaffold and does a: redirect_to(@task) - this causes a
partial to be rendered to the screen as part of my default layout, and
I was hoping to be able to verify that the partial loaded.

What would fit my brain better, would be:
response.should render_partial("tasks/list")
...but that isn't available :)

I hope that is clearer - I am quite new to the world of rspec.
If you can shed any more light that would be really great.
Thanks,
Steven


On Sat, May 3, 2008 at 11:17 PM, Rick DeNatale <[EMAIL PROTECTED]> wrote:
>
> On Sat, May 3, 2008 at 4:08 PM, steven shingler <[EMAIL PROTECTED]> wrote:
>  > hi all,
>  >
>  >  i'm just trying to check a partial has been rendered, by using:
>  >  response.template.should_receive(:render).with(:partial => "tasks/list")
>  >
>  >  this passes, even if I put something bogus in the partial name, such as:
>  >  response.template.should_receive(:render).with(:partial =>
>  >  "___tassdfsdfks/list")
>  >
>  >  does anyone know why this doesn't fail?
>  >  is this the wrong way to simply check a partial is being rendered?
>  >  am running this as a story step.
>
>  I'm not sure how this is working to begin with.
>
>  Where is this expectation in the flow of the code?  It would seem to
>  need to be before the request since it's a should_receive
>  But then what's response at this point?
>  And what's response.template?
>
>  It's the controller, not the template which receives the render call.
>
>  You say that this is in a story step? I've got a hunch that the step
>  is'nt actually matching and therfore not getting run, which would
>  explain why the assertion never fails.
>
>  If you're doing this as a full stack rails integration story, I don't
>  believe that you've got access to the controller, and this level of
>  specification doesn't belong here but rather in a controller spec,
>  where you might want to use expect_render instead of
>  should_receive(:render) as well.
>
>  --
>  Rick DeNatale
>
>  My blog on Ruby
>  http://talklikeaduck.denhaven2.com/
>  _______________________________________________
>  rspec-users mailing list
>  rspec-users@rubyforge.org
>  http://rubyforge.org/mailman/listinfo/rspec-users
>
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to