[rspec-users] problem rendering template with story

Tim Haines tmhaines at gmail.com
Wed Apr 2 20:38:03 EDT 2008


I got this way wrong.  It was due to pages not rendering due to there being
an error in the view (that I wasn't aware of).  The problem in the view was
due to the test database not being up to date with the latest migrations...
(so page was rendering correctly in dev mode)  I'm happy I've persisted with
it and now finally have a bunch of working stories...

Tim.

On 02/04/2008, Tim Haines <tmhaines at gmail.com> wrote:
>
> And I suspect this is because @first_render isn't being set for subsequent
> renders.... but it's time to go home now.
>
> On 02/04/2008, Tim Haines <tmhaines at gmail.com> wrote:
> >
> > Hi,
> >
> > Made a little progress here.  In one of my "given" steps I was posting
> > to the login action.  when I take this post out (and make other changes
> > required), the should render_template works correctly.   It's as though the
> > earlier post in the given step is meaning that the response isn't set
> > correctly after the later post..
> >
> > Tim.
> >
> > On 02/04/2008, Tim Haines <tmhaines at gmail.com> wrote:
> > >
> > > 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 passing:
> > >
> > >   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')
> > >   end
> > >
> > >
> > > But my story is failing on the "then" step:
> > >
> > >  When "I view the home page" do
> > >     get admin_url
> > >   end
> > >
> > >   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.
> > >   end
> > >
> > > 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..
> > >
> > > Cheers,
> > >
> > > Tim.
> > >
> > >
> >
> >
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://rubyforge.org/pipermail/rspec-users/attachments/20080403/53d59eec/attachment.html 


More information about the rspec-users mailing list