Rails / Rspec:未初始化的常量Rails(NameError)

时间:2013-09-18 02:49:35

标签: ruby-on-rails rspec-rails

当我运行bundle exec rake spec时,我一直遇到此错误:uninitialized constant Rails (NameError)

这是我的gemfile:

group :development do
  gem 'guard-rspec'
  gem 'guard-spork'
end

group :development, :test  do
  gem "debugger-ruby_core_source", "~> 1.2.2"
  gem 'debugger' 
  gem 'faker'
  gem 'rspec-rails' 
  gem 'factory_girl_rails'
  gem 'spork-rails', "~> 3.2"
  gem "database_cleaner", "~> 0.9"
end

group :test do
  gem 'capybara' 
  gem 'guard-rspec' 
  gem 'launchy'
  gem "shoulda-matchers", "~> 2.0"
  gem "selenium-webdriver"
  gem "rspec-sidekiq"
end

我无法弄清楚为什么会这样......

1 个答案:

答案 0 :(得分:0)

如果这是你的完整

  

的Gemfile

内容比我认为添加这个应解决问题

source 'https://rubygems.org'

gem 'rails', '3.2.13'

你要

  

未初始化的常量Rails(NameError)

因为您没有将rails添加到gemfile