Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Rspec/Rails: uninitialized constant ActiveSupport::Autoload (NameError)

I am trying to run bundle exec rspec but am getting the following error that is being thrown in my call to spec_helper.rb

template.rb:8:in `<class:Template>': uninitialized constant ActiveSupport::Autoload (NameError)

Here is my spec_helper.rb file:

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
like image 617
Thalatta Avatar asked Jul 21 '14 22:07

Thalatta


1 Answers

After switching the order of my Rspec file to the following, I no longer get the uninitialized constant error:

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!
like image 122
Thalatta Avatar answered Oct 18 '22 14:10

Thalatta