account_domain_block_spec.rb 767 B

123456789101112131415161718192021222324
  1. # frozen_string_literal: true
  2. require 'rails_helper'
  3. RSpec.describe AccountDomainBlock do
  4. it 'removes blocking cache after creation' do
  5. account = Fabricate(:account)
  6. Rails.cache.write("exclude_domains_for:#{account.id}", 'a.domain.already.blocked')
  7. described_class.create!(account: account, domain: 'a.domain.blocked.later')
  8. expect(Rails.cache.exist?("exclude_domains_for:#{account.id}")).to be false
  9. end
  10. it 'removes blocking cache after destruction' do
  11. account = Fabricate(:account)
  12. block = described_class.create!(account: account, domain: 'domain')
  13. Rails.cache.write("exclude_domains_for:#{account.id}", 'domain')
  14. block.destroy!
  15. expect(Rails.cache.exist?("exclude_domains_for:#{account.id}")).to be false
  16. end
  17. end