Convert attempt IP from EmailDomainBlock history tracking to string before recording (#38137)

This commit is contained in:
Matt Jankowski
2026-03-11 06:49:07 -04:00
committed by GitHub
parent d047a10cf5
commit dc004caf71
3 changed files with 10 additions and 6 deletions

View File

@@ -56,16 +56,20 @@ RSpec.describe EmailDomainBlock do
end
describe '.requires_approval?' do
subject { described_class.requires_approval?(input) }
subject { described_class.requires_approval?(input, attempt_ip: IPAddr.new('100.100.100.100')) }
let(:input) { nil }
context 'with a matching block requiring approval' do
before { Fabricate :email_domain_block, domain: input, allow_with_approval: true }
let!(:email_domain_block) { Fabricate :email_domain_block, domain: input, allow_with_approval: true }
let(:input) { 'host.example' }
it { is_expected.to be true }
it 'returns true and records attempt' do
expect do
expect(subject).to be(true)
end.to change { email_domain_block.history.get(Date.current).accounts }.by(1)
end
end
context 'with a matching block not requiring approval' do