2

嗨,我正在使用 Spork gem 加载运行测试所需的数据,但是在加载 Spork 时出现以下错误

Using RSpec, 
Loading Spork.prefork block...
uninitialized constant ActionMailer (NameError)
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:230:in 'block in constantize'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:229:in 'each'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/activesupport-3.2.14/lib/active_support/inflector/methods.rb:229:in 'constantize'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/activesupport-3.2.14/lib/active_support/core_ext/string/inflections.rb:54:in 'constantize'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/devise-3.0.3/app/mailers/devise/mailer.rb:1:in '<top (required)>'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/railties-3.2.14/lib/rails/engine.rb:444:in 'block (2 levels) in eager_load!'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/railties-3.2.14/lib/rails/engine.rb:443:in 'each'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/railties-3.2.14/lib/rails/engine.rb:443:in 'block in eager_load!'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/railties-3.2.14/lib/rails/engine.rb:441:in 'each'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/railties-3.2.14/lib/rails/engine.rb:441:in 'eager_load!'
/home/apellizz/Scrivania/ruby_sites/spec/spec_helper.rb:19:in 'block (2 levels) in <top (required)>'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/railties-3.2.14/lib/rails/application/railties.rb:8:in 'each'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/railties-3.2.14/lib/rails/application/railties.rb:8:in 'all'
/home/apellizz/Scrivania/ruby_sites/spec/spec_helper.rb:19:in 'block in <top (required)>'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork.rb:24:in 'prefork'
/home/apellizz/Scrivania/ruby_sites/spec/spec_helper.rb:5:in '<top (required)>'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:138:in 'load'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:138:in 'block (2 levels) in preload'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/app_framework.rb:49:in 'preload'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:134:in 'block in preload'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork.rb:62:in 'exec_prefork'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/test_framework.rb:120:in 'preload'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/run_strategy/forking.rb:25:in 'preload'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/runner.rb:74:in 'run'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/lib/spork/runner.rb:10:in 'run'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/gems/spork-1.0.0rc3/bin/spork:10:in '<top (required)>'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/bin/spork:23:in 'load'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/bin/spork:23:in '<main>'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/bin/ruby_noexec_wrapper:14:in 'eval'
/home/apellizz/.rvm/gems/ruby-1.9.3-p448@mytests.ruby_sites/bin/ruby_noexec_wrapper:14:in '<main>'

导致错误的行是

 Rails.application.railties.all { |r| r.eager_load! }

我该如何解决这个问题?或者,至少,让 spork 不加载 ActionMailer railtie?

更多信息:

我现在不在乎电子邮件

我正在使用设计

我的应用程序/邮件文件夹是空的

4

1 回答 1

0

我找到了解决方案:我的 config/application.rb 中没有包含 rails/actionmailer。这解决了问题。

于 2013-10-04T10:52:49.577 回答