Rspec / Rails:未初始化的常量ActiveSupport :: Autoload(NameError)
我正在尝试运行bundle exec rspec
但得到了我在调用spec_helper.rb
抛出的以下错误
template.rb:8:in `<class:Template>': uninitialized constant ActiveSupport::Autoload (NameError)
这是我的spec_helper.rb
文件:
require 'rubygems'
require 'rspec/rails'
ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
RSpec.configure do |config|
config.infer_spec_type_from_file_location!
end
在将我的Rspec文件的顺序切换到以下之后,我不再收到未初始化的常量错误:
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'
require 'capybara/poltergeist'
Capybara.register_driver :poltergeist do |app|
Capybara::Poltergeist::Driver.new(app, {:js_errors=> false})
end
RSpec.configure do |config|
config.infer_spec_type_from_file_location!
链接地址: http://www.djcxy.com/p/21909.html
上一篇: Rspec/Rails: uninitialized constant ActiveSupport::Autoload (NameError)