Sha256: 0c555226933ee967f4e65f6b7fdf13628a3aaf822bb3adb0c1ab3e6ec63690ab

Contents?: true

Size: 838 Bytes

Versions: 15

Compression:

Stored size: 838 Bytes

Contents

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

15 entries across 15 versions & 1 rubygems

Version Path
g5_authenticatable-0.9.1.pre.2 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.8.1.pre spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.8.0 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.8.0.beta1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.5 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.5.beta spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.4 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.4.beta.1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.3 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.2 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.7.0 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.6.0 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.5.1 spec/support/shared_examples/super_admin_authorizer.rb
g5_authenticatable-0.5.0 spec/support/shared_examples/super_admin_authorizer.rb