On Wed, Mar 12, 2008 at 3:19 AM, David Schmidt <[EMAIL PROTECTED]> wrote:
> I'm currently working on some RSpec view tests and I'm having problems
>  with expect_render.  Most of the expect_render's work fine, but in one
>  of my views I have:
>
>  <%= render :partial => "user_cloud", :locals => {:user =>
>  @featured_user} %>
>
>  I see that expect_render supports ":object" or ":collection" for the
>  second parameter, but this partial uses ":locals".  I tried
>  expect_render without the second parameter and with ":locals" and it
>  failed to match both times.  I confirmed that the partial is rendering
>  in the test.log.  Is there a way to match this render?

Sounds like a missing feature. Please enter a ticket at
http://rspec.lighthouseapp.com.

>
>  On a similar note, is there a way to test that layout views are
>  rendered?

Not in view specs. Layouts are rendered by controllers, not by the
views themselves, so you should do that in controller specs.

Cheers,
David

> I can test that the :partials in the layout are rendered,
>  but not the layout file itself.
>
>  In both of these cases I know I could do a "has_tag" and test for
>  something inside the layout file or partial, but I'd rather test
>  contents in a view test for each partial and just verify that the
>  partial is rendered in the view tests that render the partial.
>
>  Thank you,
>
>  David
>  _______________________________________________
>  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