[rspec-users] Controller Specs - undefined local variable or method 'app'

Doug Bryant doug+rspecuser at netinlet.com
Sat Feb 12 17:08:59 EST 2011


Your hunch looks correct - I ran it through the debugger last night and
found the spot where it was failing in rack-test although I don't know why
it was failing.

I removed this line from my spec_helper.rb:

> config.include Rack::Test::Methods


and it magically started working again.

Thanks for taking the time to look at it.

Doug





On Sat, Feb 12, 2011 at 2:39 PM, James Martin <jimmymartin at gmail.com> wrote:

> Not 100% sure, but that failure looks suspiciously like something you
> get when using rack-test; which expects an 'app' method to be defined
> that returns an instance of your rack-compatible application.
>
> On Saturday, February 12, 2011, Doug Bryant <doug+rspecuser at netinlet.com>
> wrote:
> > On one of my projects using rspec 2.5 & rails 3.0.4, I recently moved
> from postgres to mongo and am using mongoid as the persistence library.
> > I ported all the models over to the mongoid way of doing things and now
> have all my models passing the tests.
> >
> >
> > None of the controller test work any more.  They all fail with the
> following error message about undefined local variable or method.
> >
> >
> >   Failure/Error: post :create, :account => {}
> >      NameError:
> >        undefined local variable or method `app' for
> #<RSpec::Core::ExampleGroup::Nested_1::Nested_5::Nested_2:0x00000102cb6698>
> >      # ./spec/controllers/accounts_controller_spec.rb:84:in `block (4
> levels) in <top (required)>'
> >
> >
> >
> >
> > Has anyone else run across this?  Any ideas about how to fix it?
> > Doug
> >
> _______________________________________________
> rspec-users mailing list
> rspec-users at rubyforge.org
> http://rubyforge.org/mailman/listinfo/rspec-users
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://rubyforge.org/pipermail/rspec-users/attachments/20110212/ef064a09/attachment-0001.html>


More information about the rspec-users mailing list