[rspec-users] Documentation Nit
aslak.hellesoy at gmail.com
Tue Nov 21 02:15:59 EST 2006
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
> 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
> render :action => 'list'
> and the spec for that:
> specify "should render using the list *action*" do
> controller.should_render :action => 'list'
> 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'
> Useful info? I'm a newbie, so just trying to help out.
> rspec-users mailing list
> rspec-users at rubyforge.org
More information about the rspec-users