我正在使用Rails 5.0.0.beta3,一切正常,在我整合sendgrid-rails后,我在运行rspec
There was an error while trying to load the gem 'sendgrid-rails'. (Bundler::GemRequireError)
Gem Load Error is: uninitialized constant AbstractController::Rendering
Backtrace for gem load error is:
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.beta3/lib/action_controller/base.rb:204:in `<class:Base>'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.beta3/lib/action_controller/base.rb:164:in `<module:ActionController>'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/actionpack-5.0.0.beta3/lib/action_controller/base.rb:5:in `<top (required)>'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.beta3/lib/action_view/test_case.rb:11:in `<class:TestCase>'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.beta3/lib/action_view/test_case.rb:10:in `<module:ActionView>'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/actionview-5.0.0.beta3/lib/action_view/test_case.rb:8:in `<top (required)>'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/rails-controller-testing-0.1.1/lib/rails-controller-testing.rb:16:in `block in <top (required)>'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.beta3/lib/active_support/lazy_load_hooks.rb:38:in `instance_eval'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.beta3/lib/active_support/lazy_load_hooks.rb:38:in `execute_hook'
/Users/hieupham/.rvm/gems/ruby-2.3.0/gems/activesupport-5.0.0.beta3/lib/active_support/lazy_load_hooks.rb:45:in `block in run_load_hooks'
我认为这只发生在Rails 5上,你对这类问题有经验吗?
如何解决这个问题?顺便说一句,我为作者提出了issue
由于
答案 0 :(得分:4)
我刚刚解决了这个问题:
将require false
添加到gemfile
group :test do
gem 'rails-controller-testing', :require => false
end
需要test_helper.rb
或rails_helper.rb
之后的其他
# Other configs
require 'rails-controller-testing'