logo

mastofe

My custom branche(s) on git.pleroma.social/pleroma/mastofe git clone https://hacktivis.me/git/mastofe.git

account_domain_block_spec.rb (756B)


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