Module: Spree::TestingSupport::AuthorizationHelpers::Controller

Includes:
CustomAbility
Defined in:
lib/spree/testing_support/authorization_helpers.rb

Instance Method Summary collapse

Methods included from CustomAbility

#build_ability

Instance Method Details

#stub_authorization!(&block) ⇒ Object



17
18
19
20
21
22
23
24
25
# File 'lib/spree/testing_support/authorization_helpers.rb', line 17

def stub_authorization!(&block)
  let(:admin_user) { FactoryBot.create(:admin_user) }

  before do
    if defined?(Spree::Admin::BaseController)
      allow_any_instance_of(Spree::Admin::BaseController).to receive(:try_spree_current_user).and_return(admin_user)
    end
  end
end