Sha256: 9fe40c104cfe8fb3c0b3bc8c10a11668dfea48e4de46f80378aef0484b462aa1

Contents?: true

Size: 875 Bytes

Versions: 5

Compression:

Stored size: 875 Bytes

Contents

# frozen_string_literal: true

RSpec.shared_examples_for 'a super_admin authorizer' do
  context 'when user is an admin' do
    let(:user) { FactoryGirl.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) { FactoryGirl.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) { FactoryGirl.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) { FactoryGirl.create(:g5_authenticatable_super_admin) }

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
g5_authenticatable-1.0.0 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.0.0.pre.4 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.0.0.pre.3 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.0.0.pre.2 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-1.0.0.pre.1 spec/support/shared_examples/super_admin_authorizer.rb