On 11/21/06, s.ross <cwdinfo at gmail.com> wrote:> I''m trying to wrap my head around rspec_on_rails and ran into the
> following documentation nit:
>
> -------- what it says --------
>
> You can specify :template, :text, or :action.
> controller.should_render
:template=>"path/to/template/for/action"
> controller.should_render :text=>"expected text"
> controller.should_render :action=>"expected_action"
>
> -------- what it means --------
>
Thanks, I''ve added this to the docs, which will be published with the
next release.
> You can specify :template, :text, or :action, depending on how the
> rendering was supposed to happen in your code. So, for example, if
> you planned to render something as text, you would use:
>
> controller.should_render :text => "it''s a bird,
it''s a plane, nope,
> it''s a bird alright."
>
> If your controller is expected to render by action (and only by
> action), then then use :action. Here is some controller code:
>
> def index
> list
> render :action => ''list''
> end
>
> and the spec for that:
>
> specify "should render using the list *action*" do
> controller.should_render :action => ''list''
> end
>
> Note that while the above example works properly, the following
> fails, even though you knew the exact correct template name:
>
> specify "should render using the list template" do
> controller.should_render :template => ''users/list''
> end
>
> Useful info? I''m a newbie, so just trying to help out.
>
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>