diff options
author | Claire <claire.github-309c@sitedethib.com> | 2021-11-25 20:21:25 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-25 20:21:25 +0100 |
commit | 8c2fe2a846dd14914f7faa4bf71be21058249a93 (patch) | |
tree | 4358056c2b702a1bf9cc4d18e558f53e9e8a65c9 /spec/models | |
parent | 3ba7c85ec9bd5dcf75b30b00ed634b3b31a029af (diff) | |
parent | 534b0a270422f33b6f8b0a8e9246eb34416cfb3b (diff) |
Merge pull request #1635 from ClearlyClaire/glitch-soc/merge-upstream
Merge upstream changes
Diffstat (limited to 'spec/models')
-rw-r--r-- | spec/models/account_spec.rb | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/spec/models/account_spec.rb b/spec/models/account_spec.rb index 03d6f5fb0..65e6714c0 100644 --- a/spec/models/account_spec.rb +++ b/spec/models/account_spec.rb @@ -5,6 +5,37 @@ RSpec.describe Account, type: :model do let(:bob) { Fabricate(:account, username: 'bob') } subject { Fabricate(:account) } + describe '#suspend!' do + it 'marks the account as suspended' do + subject.suspend! + expect(subject.suspended?).to be true + end + + it 'creates a deletion request' do + subject.suspend! + expect(AccountDeletionRequest.where(account: subject).exists?).to be true + end + + context 'when the account is of a local user' do + let!(:subject) { Fabricate(:account, user: Fabricate(:user, email: 'foo+bar@domain.org')) } + + it 'creates a canonical domain block' do + subject.suspend! + expect(CanonicalEmailBlock.block?(subject.user_email)).to be true + end + + context 'when a canonical domain block already exists for that email' do + before do + Fabricate(:canonical_email_block, email: subject.user_email) + end + + it 'does not raise an error' do + expect { subject.suspend! }.not_to raise_error + end + end + end + end + describe '#follow!' do it 'creates a follow' do follow = subject.follow!(bob) |