Sha256: 04b7625c2b144f58e9961dee0bed62c79f3bf248f1b75dbf8d895e76bd6d7884

Contents?: true

Size: 871 Bytes

Versions: 13

Compression:

Stored size: 871 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_examples_for 'a super_admin authorizer' do
  context 'when user is an admin' do
    let(:user) { FactoryBot.create(:g5_authenticatable_admin) }

    it 'denies access' do
      expect(policy).to_not permit(user, record)
    end
  end

  context 'when user is an editor' do
    let(:user) { FactoryBot.create(:g5_authenticatable_editor) }

    it 'denies access' do
      expect(policy).to_not permit(user, record)
    end
  end

  context 'when user is a viewer' do
    let(:user) { FactoryBot.create(:g5_authenticatable_user) }

    it 'denies access' do
      expect(policy).to_not permit(user, record)
    end
  end

  context 'when user has super_admin role' do
    let(:user) { FactoryBot.create(:g5_authenticatable_super_admin) }

    it 'permits access' do
      expect(policy).to permit(user, record)
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
g5_authenticatable-1.1.4 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.4.rc.3 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.4.rc.2 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.4.rc.1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.2 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.2.pre.1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.2.rc.5 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.2.rc.4 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.2.rc.3 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.2.rc.2 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.2.rc.1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.1.0 spec/support/shared_examples/super_admin_authorizer.rb