mirror of
https://github.com/discourse/discourse.git
synced 2025-05-30 07:11:34 +08:00
FIX: error when trying to block an IP address. Return a message when IP address matches an existing screened IP address, including ranges.
This commit is contained in:
@ -31,6 +31,13 @@ describe ScreenedIpAddress do
|
||||
described_class.new(valid_params.merge(action_name: nil))
|
||||
}.to raise_error(ArgumentError)
|
||||
end
|
||||
|
||||
it 'returns a useful error if ip address matches an existing record' do
|
||||
ScreenedIpAddress.create(ip_address: '2600:387:b:f::7a/128', action_name: :block)
|
||||
r = ScreenedIpAddress.new(ip_address: '2600:387:b:f::7a', action_name: :block)
|
||||
expect(r.save).to eq(false)
|
||||
expect(r.errors[:ip_address]).to be_present
|
||||
end
|
||||
end
|
||||
|
||||
describe "ip_address_with_mask" do
|
||||
|
Reference in New Issue
Block a user