mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-22 11:48:06 +01:00
Simplify uniqueness validation spec for IpBlock
(#32066)
This commit is contained in:
parent
5c910dc82e
commit
67504dbf9c
1 changed files with 4 additions and 9 deletions
|
@ -3,18 +3,13 @@
|
||||||
require 'rails_helper'
|
require 'rails_helper'
|
||||||
|
|
||||||
RSpec.describe IpBlock do
|
RSpec.describe IpBlock do
|
||||||
describe 'validations' do
|
describe 'Validations' do
|
||||||
|
subject { Fabricate.build :ip_block }
|
||||||
|
|
||||||
it { is_expected.to validate_presence_of(:ip) }
|
it { is_expected.to validate_presence_of(:ip) }
|
||||||
it { is_expected.to validate_presence_of(:severity) }
|
it { is_expected.to validate_presence_of(:severity) }
|
||||||
|
|
||||||
it 'validates ip uniqueness', :aggregate_failures do
|
it { is_expected.to validate_uniqueness_of(:ip) }
|
||||||
described_class.create!(ip: '127.0.0.1', severity: :no_access)
|
|
||||||
|
|
||||||
ip_block = described_class.new(ip: '127.0.0.1', severity: :no_access)
|
|
||||||
|
|
||||||
expect(ip_block).to_not be_valid
|
|
||||||
expect(ip_block).to model_have_error_on_field(:ip)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
describe '#to_log_human_identifier' do
|
describe '#to_log_human_identifier' do
|
||||||
|
|
Loading…
Reference in a new issue