mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 17:59:47 +02:00
Create white ips
This commit is contained in:
parent
254849494f
commit
8e37355e13
15 changed files with 246 additions and 3 deletions
54
spec/models/white_ip_spec.rb
Normal file
54
spec/models/white_ip_spec.rb
Normal file
|
@ -0,0 +1,54 @@
|
|||
require 'rails_helper'
|
||||
|
||||
describe WhiteIp do
|
||||
it { should belong_to(:registrar) }
|
||||
|
||||
context 'with invalid attribute' do
|
||||
before :all do
|
||||
@white_ip = WhiteIp.new
|
||||
end
|
||||
|
||||
it 'is not valid' do
|
||||
@white_ip.valid?
|
||||
@white_ip.errors.full_messages.should match_array([
|
||||
'IPv4 or IPv6 must be present'
|
||||
])
|
||||
end
|
||||
|
||||
it 'returns an error with invalid ips' do
|
||||
@white_ip.ipv4 = 'bla'
|
||||
@white_ip.ipv6 = 'bla'
|
||||
|
||||
@white_ip.valid?
|
||||
@white_ip.errors[:ipv4].should == ['is invalid']
|
||||
@white_ip.errors[:ipv6].should == ['is invalid']
|
||||
end
|
||||
end
|
||||
|
||||
# context 'with valid attributes' do
|
||||
# before :all do
|
||||
# @white_ip = Fabricate(:white_ip)
|
||||
# end
|
||||
|
||||
# it 'should be valid' do
|
||||
# @white_ip.valid?
|
||||
# @white_ip.errors.full_messages.should match_array([])
|
||||
# end
|
||||
|
||||
# it 'should be valid twice' do
|
||||
# @white_ip = Fabricate(:white_ip)
|
||||
# @white_ip.valid?
|
||||
# @white_ip.errors.full_messages.should match_array([])
|
||||
# end
|
||||
|
||||
# it 'should have one version' do
|
||||
# with_versioning do
|
||||
# @white_ip.versions.should == []
|
||||
# @white_ip.ipv4 = '192.168.1.1'
|
||||
# @white_ip.save
|
||||
# @white_ip.errors.full_messages.should match_array([])
|
||||
# @white_ip.versions.size.should == 1
|
||||
# end
|
||||
# end
|
||||
# end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue