mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-13 04:00:21 +00:00
Spec access denied to regular user when soft-deleting variants
This commit is contained in:
7
lib/spree/api/testing_support/helpers_decorator.rb
Normal file
7
lib/spree/api/testing_support/helpers_decorator.rb
Normal file
@@ -0,0 +1,7 @@
|
||||
require 'spree/api/testing_support/helpers'
|
||||
|
||||
Spree::Api::TestingSupport::Helpers.class_eval do
|
||||
def current_api_user
|
||||
@current_api_user ||= stub_model(Spree::LegacyUser, :email => "spree@example.com", :enterprises => [])
|
||||
end
|
||||
end
|
||||
@@ -5,7 +5,7 @@ module Spree
|
||||
def sign_in_as_admin!
|
||||
let!(:current_api_user) do
|
||||
user = stub_model(Spree::LegacyUser)
|
||||
user.should_receive(:has_spree_role?).any_number_of_times.with("admin").and_return(true)
|
||||
user.stub(:has_spree_role?).with("admin").and_return(true)
|
||||
|
||||
# Stub enterprises, needed for cancan ability checks
|
||||
user.stub(:enterprises) { [] }
|
||||
|
||||
Reference in New Issue
Block a user