From 70fb99488d5477a3626dcb9279f15b2496689b21 Mon Sep 17 00:00:00 2001 From: Daniel M Brasil Date: Tue, 5 Mar 2024 10:59:39 -0300 Subject: [PATCH] add model specs --- spec/models/ip_block_spec.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/spec/models/ip_block_spec.rb b/spec/models/ip_block_spec.rb index 290b99b2884..5af6db2a5f5 100644 --- a/spec/models/ip_block_spec.rb +++ b/spec/models/ip_block_spec.rb @@ -18,6 +18,13 @@ describe IpBlock do expect(ip_block).to model_have_error_on_field(:severity) 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 described_class.create!(ip: '127.0.0.1', severity: :no_access)