Merge commit '82e477b184b5666fff7fb55933dce22ca2925db8' into glitch-soc/merge-upstream

Conflicts:
- `db/migrate/20180831171112_create_bookmarks.rb`:
  Upstream ran a lint fix on this file, but this file is different in
  glitch-soc because the feature was added much earlier.
  Ran the lint fix on our own version of the file.
This commit is contained in:
Claire
2023-07-12 16:03:05 +02:00
458 changed files with 1117 additions and 853 deletions

View File

@@ -11,14 +11,15 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do
before do
allow(user).to receive(:valid_invitation?).and_return(false)
allow_any_instance_of(described_class).to receive(:blocked_email_provider?) { blocked_email }
allow(EmailDomainBlock).to receive(:block?) { blocked_email }
end
context 'when e-mail provider is blocked' do
let(:blocked_email) { true }
it 'adds error' do
expect(subject).to have_received(:add).with(:email, :blocked)
described_class.new.validate(user)
expect(errors).to have_received(:add).with(:email, :blocked).once
end
end
@@ -26,7 +27,8 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do
let(:blocked_email) { false }
it 'does not add errors' do
expect(subject).to_not have_received(:add).with(:email, :blocked)
described_class.new.validate(user)
expect(errors).to_not have_received(:add)
end
context 'when canonical e-mail is blocked' do
@@ -37,7 +39,8 @@ RSpec.describe BlacklistedEmailValidator, type: :validator do
end
it 'adds error' do
expect(subject).to have_received(:add).with(:email, :taken)
described_class.new.validate(user)
expect(errors).to have_received(:add).with(:email, :taken).once
end
end
end