[rspec-users] Testing layouts with RSpec on Rails

Steve vertebrate at gmail.com
Mon Oct 22 20:34:47 EDT 2007


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')

Steve



More information about the rspec-users mailing list