On Jul 5, 2010, at 12:21 PM, Pixel wrote:

> On Mon, Jul 5, 2010 at 11:16 AM, David Chelimsky <dchelim...@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.

Yes, it turns out that computers are not great interpreters :)

Happy to help.

Cheers,
David
_______________________________________________
rspec-users mailing list
rspec-users@rubyforge.org
http://rubyforge.org/mailman/listinfo/rspec-users

Reply via email to