[rspec-users] problem rendering template with story

Tim Haines tmhaines at gmail.com
Tue Apr 1 22:31:47 EDT 2008

Hi y'all

The problem is probably because I'm a newb.  I have a home controller in the
admin namespace.

My controller spec is working as expected, and the following example is

  it "should show the home page if logged in" do
    controller.send("current_user=", User.new)
    get :index
    response.should render_template('admin/home/index')

But my story is failing on the "then" step:

 When "I view the home page" do
    get admin_url

  Then "I see the home page" do
    response.should_not be_redirect   # this passes
    response.code.should == "200"    # this passes

    response.should have_text(/"Client Administration."/)  #this fails, as
response.body is nil
    response.should render_template("admin/home/index")  #this fails, with
actual being nil.

It's as though the template isn't actually being rendered for some reason.
Any clues as to why this might be?  My login story uses render_template in a
similar way and it works successfully..


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080402/71c8201c/attachment-0001.html 

More information about the rspec-users mailing list