mirror of
https://github.com/internetee/registry.git
synced 2025-05-19 18:59:38 +02:00
Add tests for zonefile #2806
This commit is contained in:
parent
72b322ae1f
commit
8c6bd53019
2 changed files with 40 additions and 0 deletions
|
@ -49,4 +49,34 @@ describe ZonefileSetting do
|
|||
|
||||
@zonefile.scan(/^#{d.name}/).count.should == 0
|
||||
end
|
||||
|
||||
it 'does not create duplicate zones' do
|
||||
Fabricate(:zonefile_setting)
|
||||
expect { Fabricate(:zonefile_setting) }.to raise_error(ActiveRecord::RecordInvalid)
|
||||
end
|
||||
|
||||
it 'does not allow deleting zone when it has existing domains' do
|
||||
zs = ZonefileSetting.where({
|
||||
origin: 'ee',
|
||||
ttl: 43200,
|
||||
refresh: 3600,
|
||||
retry: 900,
|
||||
expire: 1209600,
|
||||
minimum_ttl: 3600,
|
||||
email: 'hostmaster.eestiinternet.ee',
|
||||
master_nameserver: 'ns.tld.ee'
|
||||
}).first_or_create!
|
||||
|
||||
d = Fabricate(:domain)
|
||||
|
||||
zs.destroy.should == false
|
||||
|
||||
zs.errors.full_messages.should match_array(["There are 1 domains in this zone"])
|
||||
ZonefileSetting.count.should == 1
|
||||
|
||||
d.destroy
|
||||
zs.destroy
|
||||
|
||||
ZonefileSetting.count.should == 0
|
||||
end
|
||||
end
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue