1
0

domain_block_policy_spec.rb 572 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe DomainBlockPolicy 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?, :update? do
  8. context 'when admin' do
  9. it 'permits' do
  10. expect(subject).to permit(admin, DomainBlock)
  11. end
  12. end
  13. context 'when not admin' do
  14. it 'denies' do
  15. expect(subject).to_not permit(john, DomainBlock)
  16. end
  17. end
  18. end
  19. end