From 25a0723166ec6d2f80cad3fddb4518eb87c563c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A2u=20Cao?= Date: Sun, 19 Feb 2023 11:55:53 +0800 Subject: [PATCH] Make admin flag persist for subsequent calls in spec --- spec/features/admin/dashboard_spec.rb | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/dashboard_spec.rb b/spec/features/admin/dashboard_spec.rb index 3120d5b..f0e7edb 100644 --- a/spec/features/admin/dashboard_spec.rb +++ b/spec/features/admin/dashboard_spec.rb @@ -4,7 +4,9 @@ RSpec.describe 'Admin dashboard', type: :feature do let(:user) { create :user } before do - allow(user).to receive(:is_admin?).and_return(true) + allow(Devise::LDAP::Adapter).to receive(:get_ldap_param) + .with(user.cn, :admin).and_return(["true"]) + login_as user, :scope => :user end