Notes on various ways to use Devise when writing test code with Ruby on Rails + RSpec.
Mainly read this:
・How To: Controllers and Views tests with Rails 3 (and rspec) · plataformatec/devise Wiki
■ Using stubs for current_user
Controller tests
before do
controller.stub!(:current_user).and_return(FactoryGirl.create(:user))
end
Also:
・deviseを使ったコントローラのテスト #Rails #Ruby #devise #Rspec - Qiita
That’s all from the Gemba.