我已经看过关于这个主题的其他帖子,我知道需要通过将它们添加到test_helper或spec_helper文件来启用设计辅助方法,但这似乎不起作用。
我还应该考虑解决这个问题?
我的rspec erro,
Failures:
1) LunchersController GET root renders index view for non-logged in users
Failure/Error: get :index, {}
NoMethodError:
Could not render layout: undefined method `authenticate' for nil:NilClass
# ./spec/controllers/lunchers_controller_spec.rb:6:in `block (3 levels) in <top (required)>'
我的spec_helper相关行
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
end
我没有测试/我已经创建了一个并添加了一个test_helper来查看是否包含以下帮助,但它没有。
class ActionController::TestCase
include Devise::TestHelpers
end
my gemfile
source 'https://rubygems.org'
ruby "2.1.0"
gem 'rails', '4.0.1'
gem 'sass-rails', '~> 4.0.0'
gem 'uglifier', '>= 1.3.0'
gem 'coffee-rails', '~> 4.0.0'
gem 'jquery-rails'
gem 'jbuilder', '~> 1.2'
gem "haml", "~> 4.0.4"
gem "angularjs-rails", "~> 1.2.7"
gem "zeus", "~> 0.13.3"
gem "pg", "~> 0.17.1"
gem "devise"
gem "omniauth"
gem "omniauth-twitter"
gem "uuidtools"
gem "quiet_assets", "~> 1.0.2"
gem "thin", "~> 1.6.1"
gem "jader", "~> 0.0.8"
gem "ngmin-rails", "~> 0.4.0"
gem 'foundation-rails'
gem "font-awesome-rails"
gem "twitter"
group :development, :test do
gem "rspec-rails", "~> 2.14.1"
gem 'factory_girl_rails', '4.2.1'
gem "mocha", "~> 1.0.0"
gem "database_cleaner", "~> 1.2.0"
gem 'pry'
gem 'pry-debugger'
end
group :doc do
gem 'sdoc', require: false
end