1
0

email_domain_block_policy_spec.rb 577 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe EmailDomainBlockPolicy do
  4. subject { described_class }
  5. let(:admin) { Fabricate(:user, role: UserRole.find_by(name: 'Admin')).account }
  6. let(:john) { Fabricate(:account) }
  7. permissions :index?, :show?, :create?, :destroy? do
  8. context 'when admin' do
  9. it 'permits' do
  10. expect(subject).to permit(admin, EmailDomainBlock)
  11. end
  12. end
  13. context 'when not admin' do
  14. it 'denies' do
  15. expect(subject).to_not permit(john, EmailDomainBlock)
  16. end
  17. end
  18. end
  19. end