From f56e0ba0c065fe5a47df0939da6ae03f55f7348c Mon Sep 17 00:00:00 2001 From: Luis Ramos Date: Fri, 12 Jun 2020 14:23:45 +0100 Subject: [PATCH] Mock current_spree_user to return a user without permissions so that the controller does not use an already loaded version of current_spree_user that still has enough permissions --- spec/features/admin/variant_overrides_spec.rb | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/spec/features/admin/variant_overrides_spec.rb b/spec/features/admin/variant_overrides_spec.rb index 4c2312c7ee..3db611bc42 100644 --- a/spec/features/admin/variant_overrides_spec.rb +++ b/spec/features/admin/variant_overrides_spec.rb @@ -195,7 +195,8 @@ feature " fill_in "variant-overrides-#{variant.id}-count_on_hand", with: '123' expect(page).to have_content "Changes to one override remain unsaved." - user.enterprises.clear + # Set a user without suficient permissions + allow_any_instance_of(Spree::Admin::BaseController).to receive(:current_spree_user).and_return(build(:user)) expect do click_button 'Save Changes'