我對新建立的rails項目存在以下問題。不知何故,我似乎無法正確使用Devise helpers(例如sign_in)。設計測試幫手不加載,或在RSpec中正確要求
在我的規格/支持目錄。我有一個文件名爲設計出要按照設備的自述文件,包括輔助方法,因此您可以在RSpec中使用它們:
RSpec.configure do |config|
config.include Devise::TestHelpers, :type => :controller
end
我spec_helper.rb有,當然:
Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
我一直在爭取這件事一個多小時,這讓我瘋狂。非常感謝幫助!
使用:
- Rspec的2.2.0
- 設計1.1.5
- 的Rails 3.0.3
>>我有一個名爲devise的文件<<你的意思是`devise.rb`,對嗎? – zetetic 2010-12-08 19:22:30