mirror of
https://github.com/mastodon/mastodon.git
synced 2025-05-12 04:31:11 +00:00

Some checks failed
Check i18n / check-i18n (push) Waiting to run
CodeQL / Analyze (javascript) (push) Waiting to run
CodeQL / Analyze (ruby) (push) Waiting to run
Check formatting / lint (push) Waiting to run
Ruby Testing / build (production) (push) Waiting to run
Ruby Testing / build (test) (push) Waiting to run
Ruby Testing / test (.ruby-version) (push) Blocked by required conditions
Ruby Testing / test (3.1) (push) Blocked by required conditions
Ruby Testing / test (3.2) (push) Blocked by required conditions
Ruby Testing / Libvips tests (.ruby-version) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.1) (push) Blocked by required conditions
Ruby Testing / Libvips tests (3.2) (push) Blocked by required conditions
Ruby Testing / End to End testing (.ruby-version) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.1) (push) Blocked by required conditions
Ruby Testing / End to End testing (3.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, docker.elastic.co/elasticsearch/elasticsearch:8.10.2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (.ruby-version, opensearchproject/opensearch:2) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.1, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Ruby Testing / Elastic Search integration testing (3.2, docker.elastic.co/elasticsearch/elasticsearch:7.17.13) (push) Blocked by required conditions
Crowdin / Upload translations / upload-translations (push) Has been cancelled
Ruby Linting / lint (push) Has been cancelled
Historical data migration test / test (14-alpine) (push) Has been cancelled
Historical data migration test / test (15-alpine) (push) Has been cancelled
48 lines
1.7 KiB
Ruby
48 lines
1.7 KiB
Ruby
# frozen_string_literal: true
|
|
|
|
require 'rails_helper'
|
|
|
|
RSpec.describe UnblockDomainService do
|
|
subject { described_class.new }
|
|
|
|
describe 'call' do
|
|
let!(:independently_suspended) { Fabricate(:account, domain: 'example.com', suspended_at: 1.hour.ago) }
|
|
let!(:independently_silenced) { Fabricate(:account, domain: 'example.com', silenced_at: 1.hour.ago) }
|
|
let!(:domain_block) { Fabricate(:domain_block, domain: 'example.com') }
|
|
let!(:silenced) { Fabricate(:account, domain: 'example.com', silenced_at: domain_block.created_at) }
|
|
let!(:suspended) { Fabricate(:account, domain: 'example.com', suspended_at: domain_block.created_at) }
|
|
|
|
context 'with severity of silence' do
|
|
before { domain_block.update(severity: :silence) }
|
|
|
|
it 'unsilences accounts and removes block' do
|
|
subject.call(domain_block)
|
|
|
|
expect_deleted_domain_block
|
|
expect(silenced.reload.silenced?).to be false
|
|
expect(suspended.reload.suspended?).to be true
|
|
expect(independently_suspended.reload.suspended?).to be true
|
|
expect(independently_silenced.reload.silenced?).to be true
|
|
end
|
|
end
|
|
|
|
context 'with severity of suspend' do
|
|
before { domain_block.update(severity: :suspend) }
|
|
|
|
it 'unsuspends accounts and removes block' do
|
|
subject.call(domain_block)
|
|
|
|
expect_deleted_domain_block
|
|
expect(suspended.reload.suspended?).to be false
|
|
expect(silenced.reload.silenced?).to be false
|
|
expect(independently_suspended.reload.suspended?).to be true
|
|
expect(independently_silenced.reload.silenced?).to be true
|
|
end
|
|
end
|
|
end
|
|
|
|
def expect_deleted_domain_block
|
|
expect { domain_block.reload }.to raise_error(ActiveRecord::RecordNotFound)
|
|
end
|
|
end
|