rspec テストはこのアイテムに失敗しました:
Failure/Error: before { visit user_path(user) }
ActionView::Template::Error:
undefined method `picking?' for nil:NilClass
このエラーをトリガーするコードは次のとおりです。
<% if current_user.picking?(post) %>
ユーザーモデルでは、ピッキング方法は次のように定義されています。
次のように定義された current_user:
def current_user=(user)
@current_user = user
end
def current_user
@current_user ||= user_from_remember_token
end
テストが失敗する理由 なぜcurrent_userはnilクラスですか?