about summary refs log tree commit diff
path: root/spec/services/block_domain_from_account_service_spec.rb
blob: 365c0a4aded2c9348b6e944624eff7adead42dd5 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
require 'rails_helper'

RSpec.describe BlockDomainFromAccountService, type: :service do
  let!(:wolf) { Fabricate(:account, username: 'wolf', domain: 'evil.org') }
  let!(:alice) { Fabricate(:account, username: 'alice') }

  subject { BlockDomainFromAccountService.new }

  it 'creates domain block' do
    subject.call(alice, 'evil.org')
    expect(alice.domain_blocking?('evil.org')).to be true
  end

  it 'purge followers from blocked domain' do
    wolf.follow!(alice)
    subject.call(alice, 'evil.org')
    expect(wolf.following?(alice)).to be false
  end
end