[rspec-users] Problem specing application layout, missing partial?

Pixel thecatwasnot at gmail.com
Mon Jul 5 13:21:39 EDT 2010

On Mon, Jul 5, 2010 at 11:16 AM, David Chelimsky <dchelimsky at gmail.com>wrote:

> On Jul 5, 2010, at 9:52 AM, Pixel wrote:
> In an effort to teach myself BDD I'm trying it out.  I'm trying to do a
> simple (should be straightforward) spec on my application.html.haml file
> first looking for a div tag with the class 'nav'  it seems that rspec isn't
> able to render the app/views/layouts/application.html.haml file.
> Gist with command/error/backtrace:
> http://gist.github.com/463978#file_gistfile1.txt
> Short version:
> Don't pass anything to render() in the spec. It'll do the right thing as
> long as you name the template in the string passed to describe:
> require "spec_helper"
> describe "layouts/application.html.haml" do
>   it "displays a navigation area" do
>     render
>     rendered.should have_selector('div#nav')
>   end
> end

Of course it helps when I write out the file name correctly in the describe
line, so that rspec can build the correct call.  Woops!  Thanks for your
help and patience David, much appreciated.

- Cole
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20100705/30ee2a68/attachment.html>

More information about the rspec-users mailing list