This project is archived and is in readonly mode.
Rails Engines fail to find helpers in rake test
Reported by Sam Woodard | September 22nd, 2010 @ 05:48 PM
I have
# in gem lib/my-gem.rb
module MyGem
class Engine < Rails::Engine
end
module ClassMethods
def self.extended(klass)
# do some stuff
end
def my_gem(&block)
instance_eval(&block)
include MyGem::InstanceMethods
end
end
module InstanceMethods
def self.included(controller)
controller.helper :foo
end
end
ActionController::Base.extend MyGem::ClassMethods
end
...
class ApplicationController < ActionController::Base
my_gem do
#configure my gem here
end
end
...
#in GEM_ROOT/app/helpers exits foo.rb
module FooHelper
...
end
Works: When running application no problem.
Problem: rake test
Samuel-Woodards-MacBook-Pro:account_management.git sam$ rake
test
(in /Users/sam/Development/xxx/app.git)
/Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:304:in
depend_on': Missing helper file helpers/sessions_helper.rb
(LoadError)
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:148:in `modules_for_helpers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:144:in `map!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:144:in `modules_for_helpers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/action_controller/metal/helpers.rb:101:in `modules_for_helpers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:97:in `helper'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/bundler/gems/accounts-client-3afdb6035c7b/lib/wf/accounts.rb:204:in `included'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/bundler/gems/accounts-client-3afdb6035c7b/lib/wf/accounts.rb:37:in `include'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/bundler/gems/accounts-client-3afdb6035c7b/lib/wf/accounts.rb:37:in `accounts_client'
from /Users/sam/Development/xxx/account_management.git/app/controllers/application_controller.rb:13
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:346:in `require_or_load'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:300:in `depend_on'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:138:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:137:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:137:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:135:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:135:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:108:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application/finisher.rb:41
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `run_initializers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:77:in `send'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
from /Users/sam/Development/xxx/account_management.git/config/environment.rb:5
from ./test/test_helper.rb:3:in `require'
from ./test/test_helper.rb:3
from ./test/unit/account_test.rb:1:in `require'
from ./test/unit/account_test.rb:1
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
/Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:304:in
depend_on': Missing helper file helpers/sessions_helper.rb
(LoadError)
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:148:in `modules_for_helpers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:144:in `map!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:144:in `modules_for_helpers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/action_controller/metal/helpers.rb:101:in `modules_for_helpers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/actionpack-3.0.0/lib/abstract_controller/helpers.rb:97:in `helper'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/bundler/gems/accounts-client-3afdb6035c7b/lib/wf/accounts.rb:204:in `included'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/bundler/gems/accounts-client-3afdb6035c7b/lib/wf/accounts.rb:37:in `include'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/bundler/gems/accounts-client-3afdb6035c7b/lib/wf/accounts.rb:37:in `accounts_client'
from /Users/sam/Development/xxx/account_management.git/app/controllers/application_controller.rb:13
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:227:in `load_dependency'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:239:in `require'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:346:in `require_or_load'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:300:in `depend_on'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/activesupport-3.0.0/lib/active_support/dependencies.rb:216:in `require_dependency'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:138:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:137:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:137:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:135:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/engine.rb:135:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:108:in `eager_load!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application/finisher.rb:41
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `instance_exec'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:25:in `run'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:50:in `run_initializers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/initializable.rb:49:in `run_initializers'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:134:in `initialize!'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:77:in `send'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/railties-3.0.0/lib/rails/application.rb:77:in `method_missing'
from /Users/sam/Development/xxx/account_management.git/config/environment.rb:5
from ./test/test_helper.rb:3:in `require'
from ./test/test_helper.rb:3
from ./test/functional/companies_controller_test.rb:1:in `require'
from ./test/functional/companies_controller_test.rb:1
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `load'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5:in `each'
from /Users/sam/.rvm/gems/ree-1.8.7-2010.02@account_management/gems/rake-0.8.7/lib/rake/rake_test_loader.rb:5
Errors running test:units, test:functionals!
Comments and changes to this ticket
-
Sam Woodard September 22nd, 2010 @ 05:54 PM
- Assigned user cleared.
-
Brian Lopez September 22nd, 2010 @ 10:05 PM
- State changed from new to invalid
- Importance changed from to Low
closing this.
He had his gem in the wrong group in his Gemfile
Create your profile
Help contribute to this project by taking a few moments to create your personal profile. Create your profile »
<h2 style="font-size: 14px">Tickets have moved to Github</h2>
The new ticket tracker is available at <a href="https://github.com/rails/rails/issues">https://github.com/rails/rails/issues</a>