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
Updateに接続されているユーザーのユーザー工場です:要求通り:
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