ApplicationController 메소드 인 logged_in?
이 사용자를 반환하기를 원하기 때문에 스펙이 실패합니다.RSpec :보기에서 컨트롤러 메소드 스텁
사양을 지정하는 방법을 잘 모르겠습니다. 현재 before(:each)
에서 내가 가진 :
Failure/Error: render
ActionView::Template::Error:
undefined method 'logged_in?' for #<#<Class:0x007f9c908e4b10>:0x007f9c90873b68>
FWIW : 작동하지 않는
controller.stub!(:logged_in?).and_return(FactoryGirl.create(:active_user))
@ballots = FactoryGirl.create_list(:full_ballot, 2)
:active_user
이 :full_ballot
업데이트에 연결되어있는 사용자의 사용자 공장 : 요청한대로 :
class ApplicationController < ActionController::Base
...
def current_user
@current_user ||= User.find(cookies[:id_token]) if cookies[:id_token]
end
def logged_in?
current_user
end
...
end
'current_user' 및'logged_in? '메소드를 게시 할 수 있습니까? – James