Spec access denied to regular user when soft-deleting variants

This commit is contained in:
Rohan Mitchell
2014-04-11 11:21:10 +10:00
parent d16d970952
commit 95a6e34523
4 changed files with 27 additions and 2 deletions

View 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

View File

@@ -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) { [] }