From 6cce4f9cff8e52ae6682b255abf67c2708926366 Mon Sep 17 00:00:00 2001 From: Malaber Date: Wed, 29 Apr 2026 08:32:19 +0200 Subject: [PATCH] Keep controller specs off sessions --- spec/auth_helpers.rb | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/spec/auth_helpers.rb b/spec/auth_helpers.rb index f4dabb8..e564cce 100644 --- a/spec/auth_helpers.rb +++ b/spec/auth_helpers.rb @@ -4,6 +4,9 @@ module AuthHelpers def apply_authentication_headers_for(user) user_headers = user.create_new_auth_token request.headers.merge!(user_headers) - sign_in(user, scope: :user) if respond_to?(:sign_in) + return unless respond_to?(:controller) + + allow(controller).to receive(:authenticate_user!).and_return(true) + allow(controller).to receive(:current_user).and_return(user) end end