Sha256: 0338bd1ee75f2d9fa35fc34794452063df0e44a3674569d7ca5b2be69a2e14e4
Contents?: true
Size: 891 Bytes
Versions: 3
Compression:
Stored size: 891 Bytes
Contents
module AuthorizationHelpers module Controller def stub_authorization! let(:ability_user) { stub_model(Spree::LegacyUser) } before do controller.stub(:authorize! => true) controller.stub(:try_spree_current_user => ability_user) end end end module Request class SuperAbility include CanCan::Ability def initialize(user) # allow anyone to perform index on Order can :manage, :all end end def stub_authorization! before(:all) { Spree::Ability.register_ability(AuthorizationHelpers::Request::SuperAbility) } after(:all) { Spree::Ability.remove_ability(AuthorizationHelpers::Request::SuperAbility) } end end end RSpec.configure do |config| config.extend AuthorizationHelpers::Controller, :type => :controller config.extend AuthorizationHelpers::Request, :type => :request end
Version data entries
3 entries across 3 versions & 1 rubygems