On Mar 30, 9:56 am, Zach Dennis <[email protected]> wrote:
> On Sat, Mar 28, 2009 at 9:33 PM, Brandt Kurowski
> >  #http://gist.github.com/87246
> >  describe "/layouts/application" do
> >    it "should show the content" do
> >      class << template
> >        attr_accessor :did_render_content
> >      end
> >      template.did_render_content = false
> >      render :inline => "<% self.did_render_content = true
> > %>", :layout => 'application'
> >      template.did_render_content.should be_true
> >    end
> >  end
>
> There's no need for a custom matcher. You just utilize the :layout
> option that render has. e.g. the follow example ensures the layout
> renders the content it is given (via a yield block):
>
> describe "layouts/application.html.erb" do
>   it "should render the context given" do
>     render :text => "foobar", :layout => "layouts/application.html.erb"
>     response.should include_text("foobar")
>   end
> end

Doh! Looks like I was so focused on the mechanism behind the failure
that I ended up writing my spec for the details of the implementation
rather than just the desired behavior. Thanks for pointing out what in
retrospect should've been obvious Zach.

Brandt
_______________________________________________
rspec-users mailing list
[email protected]
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to