Ruby on rails 设计3.2+;Rspec 3

Ruby on rails 设计3.2+;Rspec 3,ruby-on-rails,rspec,devise,Ruby On Rails,Rspec,Devise,我正在尝试使用Rspec构建一些测试,我得到以下错误: Failure/Error: get :index NoMethodError: undefined method `authenticate!' for nil:NilClass /home/bruna/Dropbox/Rails/academico/spec/spec_helper.rb:18:in `block in <top (required)>': uninitialized cons

我正在尝试使用Rspec构建一些测试,我得到以下错误:

     Failure/Error: get :index
     NoMethodError:
     undefined method `authenticate!' for nil:NilClass
/home/bruna/Dropbox/Rails/academico/spec/spec_helper.rb:18:in `block in <top (required)>': uninitialized constant Devise (NameError)
然后我进行了一些搜索,我意识到我必须在spec_helper.rb中包含这一行:

RSpec.configure do |config|
    config.include Devise::TestHelpers, type: :controller
end
似乎这段代码对大多数人有效,但对我无效。现在我得到了以下错误:

     Failure/Error: get :index
     NoMethodError:
     undefined method `authenticate!' for nil:NilClass
/home/bruna/Dropbox/Rails/academico/spec/spec_helper.rb:18:in `block in <top (required)>': uninitialized constant Devise (NameError)
/home/bruna/Dropbox/Rails/academico/spec/spec_helper.rb:18:in'block-in':未初始化的常量设计(NameError)

我认为这可能是rspec和/或Desive版本中的一些错误。有人看到过这个错误吗?请帮助我:“(

RSpec 3配置与早期版本不同,添加了每个spec文件必须包含的spec/rails\u helper.rb文件。将designe TestHelpers添加到spec/rails\u helper.rb文件中


如果您需要有关RSpec 3配置的更多信息,我已经编写了一个。在我的中,还有关于使用RSpec测试设备的信息,包括关于功能测试会话帮助程序的建议。

RSpec 3配置与早期版本不同,添加了一个spec/rails\u helper.rb文件,每个版本都必须包含该文件spec文件。将designe TestHelpers添加到spec/rails\u helper.rb文件中


如果您需要有关RSpec 3配置的更多信息,我已经编写了一个。在我的中还有关于使用RSpec测试Desive的信息,包括有关功能测试会话帮助程序的建议。

您是如何安装Desive的?Desive和RSpec都列在我的GEM文件中。您是否在应用程序的其他任何地方使用Desive都没有问题?是的,我什么都做,我就是不能用rspec测试。你是如何安装designe的?designe和rspec都列在我的gemfile中。你在应用程序的其他任何地方使用designe都没有问题吗?是的,我什么都做,我就是不能用rspec测试。我已经将designe TestHelpers添加到spec/rails\u helper中,我得到了未初始化常量designe的错误(namererror),就像我在楼上说的,我已经在spec/rails\u助手中添加了designe TestHelpers,我得到了未初始化常量designe(namererror)的错误,就像我在楼上说的