I'm writing integration tests for some controller and I need to mock current_user from this (another) controller:
class ApplicationController < ActionController::Base
protect_from_forgery with: :exception
helper_method :current_user
private
def current_user
@current_user ||= User.first
end
end
I've tried to overwrite @current_user in test, but it didn't work.
Aucun commentaire:
Enregistrer un commentaire