Ruby Forum Rails Engines development > testing path problems

Posted by ben wiseley (Guest)
on 06.06.2007 21:04
(Received via mailing list)
I was converting an existing rails app to an engine... that worked fine 
-
just put everything in an engine (controllers, models, etc.).  All tests
passed if they were in the engine but, for functional tests, outside of 
the
engine, the paths to the engine don't seem to be being found.

If I put this in my environment things work again:
  %W( app/controllers app/helpers app/models app/views lib ).each do |p|
     config.load_paths += %W( #{RAILS_ROOT}/vendor/plugins/nzwe/#{p} )
   end

Any idea what I'm missing here?  Seems like having that in your 
environment
isn't a great idea because it seems like the engine plugin does that for
you, except, apparently, when running functional test.

The exact error is:
/opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in
`load_missing_constant': uninitialized constant ApplicationController
(NameError)

Which I think means it's failing to load some require/includes in
application.rb

I'm using Engines::Testing.set_fixture_path in the test_helper.rb if 
that
matters.

-ben
Posted by James Adam (Guest)
on 06.06.2007 23:16
(Received via mailing list)
On 6/6/07, ben wiseley <wiseleyb@gmail.com> wrote:
>  The exact error is:
> /opt/local/lib/ruby/gems/1.8/gems/activesupport-1.4.2/lib/active_support/dependencies.rb:266:in
> `load_missing_constant': uninitialized constant ApplicationController
> (NameError)

It sounds like you're trying to load one of your controllers before
Rails is ready.

Are you doing anything with your controllers in your init.rb files?