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

This commit is contained in:
Luis Ramos
2020-06-12 14:23:45 +01:00
parent cf5af68438
commit f56e0ba0c0

View File

@@ -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'