I am at chapter 3 of Michael Hartl's tutorial and I am stuck at the testing part. Initially it had the problem of an uninitialised constant Rails (NameError) but after adding
require 'rspec/rails'
require 'active_support'
require 'active_support/deprecation'
require 'activerecord-nulldb-adapter'
to the spec_helper.rb file, there is this new problem with uninitalised constant ActiveSupport::Autoload (NameError).
Attached is the error:
C:\Users\HuiHui\MyProject\sampleapp>bundle exec rspec spec/requests/static_pages
_spec.rb
C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionview-4.1.1/lib/action
_view/template.rb:8:in `<class:Template>': uninitialized constant ActiveSupport:
:Autoload (NameError)
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionview-4.1
.1/lib/action_view/template.rb:7:in `<module:ActionView>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionview-4.1
.1/lib/action_view/template.rb:5:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionview-4.1
.1/lib/action_view/template/resolver.rb:4:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionview-4.1
.1/lib/action_view/template/resolver.rb:4:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionview-4.1
.1/lib/action_view/testing/resolvers.rb:1:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/actionview-4.1
.1/lib/action_view/testing/resolvers.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-rails-3.
0.1/lib/rspec/rails/view_rendering.rb:1:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-rails-3.
0.1/lib/rspec/rails/view_rendering.rb:1:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-rails-3.
0.1/lib/rspec/rails.rb:4:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-rails-3.
0.1/lib/rspec/rails.rb:4:in `<top (required)>'
from C:/Users/HuiHui/MyProject/sampleapp/spec/spec_helper.rb:17:in `requ
ire'
from C:/Users/HuiHui/MyProject/sampleapp/spec/spec_helper.rb:17:in `<top
(required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration.rb:1018:in `require'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration.rb:1018:in `block in requires='
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration.rb:1018:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration.rb:1018:in `requires='
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration_options.rb:101:in `block in process_options_into
'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration_options.rb:100:in `each'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration_options.rb:100:in `process_options_into'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/configuration_options.rb:22:in `configure'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/runner.rb:96:in `setup'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/runner.rb:85:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/runner.rb:70:in `run'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/lib/rspec/core/runner.rb:38:in `invoke'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/gems/rspec-core-3.0
.1/exe/rspec:4:in `<top (required)>'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bin/rspec:23:in `lo
ad'
from C:/RailsInstaller/Ruby1.9.3/lib/ruby/gems/1.9.1/bin/rspec:23:in `<m
ain>'
Can anyone help me?
Try changing the order from
require 'rspec/rails'
require 'active_support'
require 'active_support/deprecation'
require 'activerecord-nulldb-adapter'
To
require 'active_support'
require 'active_support/core_ext'
require 'active_support/deprecation'
require 'rspec/rails'
require 'activerecord-nulldb-adapter'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With