[rspec-users] Testing layouts with RSpec on Rails

David Chelimsky dchelimsky at gmail.com
Mon Oct 22 21:06:50 EDT 2007


On 10/22/07, Steve <vertebrate at gmail.com> wrote:
> On Mon, 22 Oct 2007 04:49:50 -0500, David Chelimsky wrote:
>
> > On 10/22/07, David Chelimsky <dchelimsky at gmail.com> wrote:
> > Actually, it turns out that you can do this in a view spec:
> >
> > render "/path/to/my/file.html.erb", :layout => "application"
> >
> > and it will render with the layout. So you *could* (in theory, I
> > haven't done this yet) do something like this:
>
> It would feel even less hackish if "render" supported :text like
> rails render does. So you could do this:
>
> render :text => '<div>yielded</div>', :layout => 'application'
> response.should have_tag('div', 'yielded')

Good idea. Feature request please.


More information about the rspec-users mailing list