mirror of
https://github.com/mastodon/mastodon.git
synced 2024-08-20 21:08:15 -07:00
add model specs
This commit is contained in:
parent
c24f31ca50
commit
70fb99488d
1 changed files with 7 additions and 0 deletions
|
@ -18,6 +18,13 @@ describe IpBlock do
|
||||||
expect(ip_block).to model_have_error_on_field(:severity)
|
expect(ip_block).to model_have_error_on_field(:severity)
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'validates severity inclusion', :aggregate_failures do
|
||||||
|
ip_block = described_class.new(ip: '127.0.0.1', severity: :invalid)
|
||||||
|
|
||||||
|
expect(ip_block).to_not be_valid
|
||||||
|
expect(ip_block).to model_have_error_on_field(:severity)
|
||||||
|
end
|
||||||
|
|
||||||
it 'validates ip uniqueness', :aggregate_failures do
|
it 'validates ip uniqueness', :aggregate_failures do
|
||||||
described_class.create!(ip: '127.0.0.1', severity: :no_access)
|
described_class.create!(ip: '127.0.0.1', severity: :no_access)
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue