mirror of
https://github.com/internetee/registry.git
synced 2025-08-02 07:52:04 +02:00
Refactor zones
- Rename "zonefile_setting" to "zone" - Remove version #475
This commit is contained in:
parent
f1d7e53734
commit
bff7437277
51 changed files with 425 additions and 389 deletions
|
@ -1,4 +1,4 @@
|
|||
Fabricator(:zonefile_setting) do
|
||||
Fabricator(:zone, from: 'DNS::Zone') do
|
||||
origin 'ee'
|
||||
ttl 43200
|
||||
refresh 3600
|
12
spec/factories/dns/zone.rb
Normal file
12
spec/factories/dns/zone.rb
Normal file
|
@ -0,0 +1,12 @@
|
|||
FactoryGirl.define do
|
||||
factory :zone, class: DNS::Zone do
|
||||
origin 'test'
|
||||
ttl 1
|
||||
refresh 1
|
||||
add_attribute :retry, 1
|
||||
expire 1
|
||||
minimum_ttl 1
|
||||
email 'test@test.test'
|
||||
master_nameserver 'test.test'
|
||||
end
|
||||
end
|
16
spec/features/admin/dns/zones/delete_spec.rb
Normal file
16
spec/features/admin/dns/zones/delete_spec.rb
Normal file
|
@ -0,0 +1,16 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Deleting zone in admin area' do
|
||||
given!(:zone) { create(:zone) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
scenario 'deletes zone' do
|
||||
visit edit_admin_zone_url(zone)
|
||||
click_link_or_button t('admin.dns.zones.edit.delete_btn')
|
||||
|
||||
expect(page).to have_text(t('admin.dns.zones.destroy.destroyed'))
|
||||
end
|
||||
end
|
29
spec/features/admin/dns/zones/edit_spec.rb
Normal file
29
spec/features/admin/dns/zones/edit_spec.rb
Normal file
|
@ -0,0 +1,29 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'Editing zone in admin area' do
|
||||
given!(:zone) { create(:zone) }
|
||||
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
scenario 'updates zone' do
|
||||
open_list
|
||||
open_form
|
||||
submit_form
|
||||
|
||||
expect(page).to have_text(t('admin.dns.zones.update.updated'))
|
||||
end
|
||||
|
||||
def open_list
|
||||
click_link_or_button t('admin.menu.zones')
|
||||
end
|
||||
|
||||
def open_form
|
||||
click_link_or_button t('admin.dns.zones.zone.edit_btn')
|
||||
end
|
||||
|
||||
def submit_form
|
||||
click_link_or_button t('admin.dns.zones.form.update_btn')
|
||||
end
|
||||
end
|
39
spec/features/admin/dns/zones/new_spec.rb
Normal file
39
spec/features/admin/dns/zones/new_spec.rb
Normal file
|
@ -0,0 +1,39 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.feature 'New zone in admin area' do
|
||||
background do
|
||||
sign_in_to_admin_area
|
||||
end
|
||||
|
||||
scenario 'it creates new zone' do
|
||||
open_list
|
||||
open_form
|
||||
fill_form
|
||||
submit_form
|
||||
|
||||
expect(page).to have_text(t('admin.dns.zones.create.created'))
|
||||
end
|
||||
|
||||
def open_list
|
||||
click_link_or_button t('admin.menu.zones')
|
||||
end
|
||||
|
||||
def open_form
|
||||
click_link_or_button t('admin.dns.zones.index.new_btn')
|
||||
end
|
||||
|
||||
def fill_form
|
||||
fill_in 'zone_origin', with: 'test'
|
||||
fill_in 'zone_ttl', with: '1'
|
||||
fill_in 'zone_refresh', with: '1'
|
||||
fill_in 'zone_retry', with: '1'
|
||||
fill_in 'zone_expire', with: '1'
|
||||
fill_in 'zone_minimum_ttl', with: '1'
|
||||
fill_in 'zone_email', with: 'test@test.com'
|
||||
fill_in 'zone_master_nameserver', with: 'test.test'
|
||||
end
|
||||
|
||||
def submit_form
|
||||
click_link_or_button t('admin.dns.zones.form.create_btn')
|
||||
end
|
||||
end
|
|
@ -7,7 +7,7 @@ RSpec.describe Domain, db: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010 00:00')
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
|
||||
Fabricate.create(:domain, id: 1, expire_time: Time.zone.parse('04.07.2010 23:59'))
|
||||
Fabricate.create(:domain, id: 2, expire_time: Time.zone.parse('05.07.2010 00:00'))
|
||||
|
|
|
@ -4,7 +4,7 @@ RSpec.describe Domain do
|
|||
it { is_expected.to alias_attribute(:force_delete_time, :force_delete_at) }
|
||||
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
end
|
||||
|
||||
it 'should set force delete time' do
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe Contact do
|
||||
before :example do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'about class' do
|
||||
|
@ -328,7 +328,7 @@ end
|
|||
|
||||
describe Contact, '.destroy_orphans' do
|
||||
before do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
@contact_1 = Fabricate(:contact, code: 'asd12')
|
||||
@contact_2 = Fabricate(:contact, code: 'asd13')
|
||||
end
|
||||
|
|
|
@ -1,10 +1,6 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe ZonefileSetting, db: false do
|
||||
it 'has versions' do
|
||||
expect(described_class.new.versions).to eq([])
|
||||
end
|
||||
|
||||
RSpec.describe DNS::Zone do
|
||||
describe '::origins' do
|
||||
before :example do
|
||||
expect(described_class).to receive(:pluck).with(:origin).and_return('origins')
|
|
@ -21,7 +21,7 @@ describe Dnskey do
|
|||
|
||||
Setting.client_side_status_editing_enabled = true
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
|
|
|
@ -2,7 +2,7 @@ require 'rails_helper'
|
|||
|
||||
RSpec.describe DomainCron do
|
||||
it 'should expire domains' do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
@domain = Fabricate(:domain)
|
||||
|
||||
Setting.expire_warning_period = 1
|
||||
|
@ -25,7 +25,7 @@ RSpec.describe DomainCron do
|
|||
end
|
||||
|
||||
it 'should start redemption grace period' do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
@domain = Fabricate(:domain)
|
||||
|
||||
old_valid_to = Time.zone.now - 10.days
|
||||
|
|
|
@ -21,11 +21,11 @@ RSpec.describe Domain do
|
|||
|
||||
Setting.client_side_status_editing_enabled = true
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zonefile_setting, origin: 'pri.ee')
|
||||
Fabricate(:zonefile_setting, origin: 'med.ee')
|
||||
Fabricate(:zonefile_setting, origin: 'fie.ee')
|
||||
Fabricate(:zonefile_setting, origin: 'com.ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'pri.ee')
|
||||
Fabricate(:zone, origin: 'med.ee')
|
||||
Fabricate(:zone, origin: 'fie.ee')
|
||||
Fabricate(:zone, origin: 'com.ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
|
@ -809,7 +809,7 @@ RSpec.describe Domain, db: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010 00:00')
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
|
||||
Fabricate.create(:domain, id: 1, outzone_time: Time.zone.parse('04.07.2010 23:59'))
|
||||
Fabricate.create(:domain, id: 2, outzone_time: Time.zone.parse('05.07.2010 00:00'))
|
||||
|
@ -825,7 +825,7 @@ RSpec.describe Domain, db: false do
|
|||
before :example do
|
||||
travel_to Time.zone.parse('05.07.2010 00:00')
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
|
||||
Fabricate.create(:domain, id: 1, delete_time: Time.zone.parse('04.07.2010 23:59'))
|
||||
Fabricate.create(:domain, id: 2, delete_time: Time.zone.parse('05.07.2010 00:00'))
|
||||
|
|
|
@ -21,7 +21,7 @@ describe DomainTransfer do
|
|||
|
||||
Setting.client_side_status_editing_enabled = true
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
|
|
|
@ -21,7 +21,7 @@ describe Keyrelay do
|
|||
|
||||
Setting.client_side_status_editing_enabled = true
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
|
|
|
@ -3,11 +3,11 @@ require 'rails_helper'
|
|||
describe LegalDocument do
|
||||
context 'tasks' do
|
||||
it 'make files uniq' do
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zonefile_setting, origin: 'pri.ee')
|
||||
Fabricate(:zonefile_setting, origin: 'med.ee')
|
||||
Fabricate(:zonefile_setting, origin: 'fie.ee')
|
||||
Fabricate(:zonefile_setting, origin: 'com.ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'pri.ee')
|
||||
Fabricate(:zone, origin: 'med.ee')
|
||||
Fabricate(:zone, origin: 'fie.ee')
|
||||
Fabricate(:zone, origin: 'com.ee')
|
||||
LegalDocument.explicitly_write_file = true
|
||||
PaperTrail.enabled = true
|
||||
|
||||
|
|
|
@ -21,7 +21,7 @@ describe Nameserver do
|
|||
|
||||
Setting.client_side_status_editing_enabled = true
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
end
|
||||
|
||||
context 'with invalid attribute' do
|
||||
|
|
|
@ -21,7 +21,7 @@ describe RegistrantVerification do
|
|||
|
||||
Setting.client_side_status_editing_enabled = true
|
||||
|
||||
Fabricate(:zonefile_setting, origin: 'ee')
|
||||
Fabricate(:zone, origin: 'ee')
|
||||
end
|
||||
context 'with invalid attribute' do
|
||||
before :example do
|
||||
|
|
40
spec/views/admin/dns/zones/index.html.erb_spec.rb
Normal file
40
spec/views/admin/dns/zones/index.html.erb_spec.rb
Normal file
|
@ -0,0 +1,40 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'admin/dns/zones/index' do
|
||||
let(:zones) { [] }
|
||||
|
||||
before :example do
|
||||
assign(:zones, zones)
|
||||
stub_template '_zone' => 'zone-row'
|
||||
end
|
||||
|
||||
it 'has title' do
|
||||
render
|
||||
expect(rendered).to have_text(t('admin.dns.zones.index.title'))
|
||||
end
|
||||
|
||||
context 'when zones are present' do
|
||||
let(:zones) { [build_stubbed(:zone)] }
|
||||
|
||||
it 'has zone row' do
|
||||
render
|
||||
expect(rendered).to have_text('zone-row')
|
||||
end
|
||||
|
||||
it 'has no :not_found message' do
|
||||
render
|
||||
expect(rendered).to_not have_text(not_found_message)
|
||||
end
|
||||
end
|
||||
|
||||
context 'when zones are absent' do
|
||||
it 'has :not_found message' do
|
||||
render
|
||||
expect(rendered).to have_text(not_found_message)
|
||||
end
|
||||
end
|
||||
|
||||
def not_found_message
|
||||
t('admin.dns.zones.index.not_found')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue