mirror of
https://github.com/internetee/registry.git
synced 2025-08-01 23:42:04 +02:00
Merge branch 'master' of github.com:internetee/registry
This commit is contained in:
commit
70d600c487
13 changed files with 130 additions and 36 deletions
|
@ -52,7 +52,7 @@ describe 'EPP Contact', epp: true do
|
|||
expect(id.text).to eq('sh8013')
|
||||
#5 seconds for what-ever weird lag reasons might happen
|
||||
expect(crDate.text.to_time).to be_within(5).of(Time.now)
|
||||
|
||||
|
||||
end
|
||||
|
||||
it 'does not create duplicate contact' do
|
||||
|
@ -62,7 +62,7 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
expect(response[:result_code]).to eq('2302')
|
||||
expect(response[:msg]).to eq('Contact id already exists')
|
||||
|
||||
|
||||
expect(Contact.count).to eq(1)
|
||||
end
|
||||
end
|
||||
|
@ -72,12 +72,13 @@ describe 'EPP Contact', epp: true do
|
|||
it "fails if request is invalid" do
|
||||
response = epp_request('contacts/update_missing_attr.xml')
|
||||
#response = epp_request(contact_update_xml( {id: false} ), :xml)
|
||||
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2003')
|
||||
expect(response[:results][0][:msg]).to eq('Required parameter missing: id')
|
||||
expect(response[:results].count).to eq 1
|
||||
end
|
||||
|
||||
|
||||
it 'fails with wrong authentication info' do
|
||||
Fabricate(:contact, code: 'sh8013', auth_info: 'secure_password')
|
||||
|
||||
|
@ -89,14 +90,14 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
it 'stamps updated_by succesfully' do
|
||||
Fabricate(:contact, code: 'sh8013')
|
||||
|
||||
|
||||
expect(Contact.first.updated_by_id).to be nil
|
||||
|
||||
|
||||
response = epp_request(contact_update_xml, :xml)
|
||||
|
||||
expect(Contact.first.updated_by_id).to eq 1
|
||||
end
|
||||
|
||||
|
||||
it 'is succesful' do
|
||||
Fabricate(:contact, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013', auth_info: '2fooBAR')
|
||||
#response = epp_request(contact_update_xml( { chg: { email: 'fred@bloggers.ee', postalInfo: { name: 'Fred Bloggers' } } } ), :xml)
|
||||
|
@ -108,19 +109,19 @@ describe 'EPP Contact', epp: true do
|
|||
expect(Contact.first.ident).to eq('J836954')
|
||||
expect(Contact.first.ident_type).to eq('passport')
|
||||
end
|
||||
|
||||
it 'returns phone and email error' do
|
||||
|
||||
it 'returns phone and email error' do
|
||||
Fabricate(:contact, created_by_id: 1, email: 'not_updated@test.test', code: 'sh8013', auth_info: '2fooBAR')
|
||||
#response = epp_request(contact_update_xml( { chg: { email: "qwe", phone: "123qweasd" } }), :xml)
|
||||
response = epp_request('contacts/update_with_errors.xml')
|
||||
|
||||
|
||||
expect(response[:results][0][:result_code]).to eq('2005')
|
||||
expect(response[:results][0][:msg]).to eq('Phone nr is invalid')
|
||||
|
||||
|
||||
expect(response[:results][1][:result_code]).to eq('2005')
|
||||
expect(response[:results][1][:msg]).to eq('Email is invalid')
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
context 'delete command' do
|
||||
it "fails if request is invalid" do
|
||||
|
@ -160,7 +161,7 @@ describe 'EPP Contact', epp: true do
|
|||
|
||||
it 'returns info about contact availability' do
|
||||
Fabricate(:contact, code: 'check-1234')
|
||||
|
||||
|
||||
response = epp_request(contact_check_xml( ids: [{ id: 'check-1234'}, { id: 'check-4321' }] ), :xml)
|
||||
|
||||
expect(response[:result_code]).to eq('1000')
|
||||
|
@ -174,7 +175,7 @@ describe 'EPP Contact', epp: true do
|
|||
expect(ids[1].text).to eq('check-4321')
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
context 'info command' do
|
||||
it "fails if request invalid" do
|
||||
response = epp_request('contacts/delete_missing_attr.xml')
|
||||
|
|
3
spec/fabricators/setting_fabricator.rb
Normal file
3
spec/fabricators/setting_fabricator.rb
Normal file
|
@ -0,0 +1,3 @@
|
|||
Fabricator(:setting) do
|
||||
code 'ns_min_count'
|
||||
end
|
7
spec/fabricators/setting_group_fabricator.rb
Normal file
7
spec/fabricators/setting_group_fabricator.rb
Normal file
|
@ -0,0 +1,7 @@
|
|||
Fabricator(:setting_group) do
|
||||
code 'domain_validation'
|
||||
settings { [
|
||||
Fabricate(:setting, code: 'ns_min_count', value: 1),
|
||||
Fabricate(:setting, code: 'ns_max_count', value: 13)
|
||||
]}
|
||||
end
|
37
spec/features/setting_management_spec.rb
Normal file
37
spec/features/setting_management_spec.rb
Normal file
|
@ -0,0 +1,37 @@
|
|||
require 'rails_helper'
|
||||
|
||||
feature 'Setting management' do
|
||||
background { Fabricate(:setting_group) }
|
||||
|
||||
scenario 'User changes a setting', js: true do
|
||||
visit root_path
|
||||
|
||||
# This ensures javascript works correctly
|
||||
expect(page).to have_no_link 'Setting groups'
|
||||
click_on 'Settings'
|
||||
expect(page).to have_link 'Setting groups'
|
||||
|
||||
click_on 'Setting groups'
|
||||
expect(page).to have_text('Domain validation')
|
||||
click_on 'Edit settings'
|
||||
expect(page).to have_text('Nameserver minimum count')
|
||||
expect(page).to have_text('Nameserver maximum count')
|
||||
|
||||
val_min = find_field('Nameserver minimum count').value
|
||||
val_max = find_field('Nameserver maximum count').value
|
||||
|
||||
expect(val_min).to eq('1')
|
||||
expect(val_max).to eq('13')
|
||||
|
||||
fill_in('Nameserver minimum count', with: '3')
|
||||
fill_in('Nameserver maximum count', with: '10')
|
||||
|
||||
click_on 'Save'
|
||||
|
||||
val_min = find_field('Nameserver minimum count').value
|
||||
val_max = find_field('Nameserver maximum count').value
|
||||
|
||||
expect(val_min).to eq('3')
|
||||
expect(val_max).to eq('10')
|
||||
end
|
||||
end
|
|
@ -34,7 +34,7 @@ describe Contact do
|
|||
before(:each) { @contact = Fabricate(:contact) }
|
||||
|
||||
it 'should return true' do
|
||||
expect(@contact.valid?).to be true
|
||||
expect(@contact.valid?).to be true
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
5
spec/models/setting_group_spec.rb
Normal file
5
spec/models/setting_group_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
require "rails_helper"
|
||||
|
||||
describe SettingGroup do
|
||||
it { should have_many(:settings) }
|
||||
end
|
5
spec/models/setting_spec.rb
Normal file
5
spec/models/setting_spec.rb
Normal file
|
@ -0,0 +1,5 @@
|
|||
require "rails_helper"
|
||||
|
||||
describe Setting do
|
||||
it { should belong_to(:setting_group) }
|
||||
end
|
|
@ -4,6 +4,7 @@ require 'spec_helper'
|
|||
require File.expand_path("../../config/environment", __FILE__)
|
||||
require 'rspec/rails'
|
||||
require 'shoulda/matchers'
|
||||
require 'capybara/poltergeist'
|
||||
|
||||
# Requires supporting ruby files with custom matchers and macros, etc, in
|
||||
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
|
||||
|
@ -39,6 +40,10 @@ RSpec.configure do |config|
|
|||
DatabaseCleaner.strategy = :truncation
|
||||
end
|
||||
|
||||
config.before(:each, js: true) do
|
||||
DatabaseCleaner.strategy = :truncation
|
||||
end
|
||||
|
||||
config.before(:each) do
|
||||
DatabaseCleaner.start
|
||||
end
|
||||
|
@ -47,6 +52,8 @@ RSpec.configure do |config|
|
|||
DatabaseCleaner.clean
|
||||
end
|
||||
|
||||
Capybara.javascript_driver = :poltergeist
|
||||
|
||||
# RSpec Rails can automatically mix in different behaviours to your tests
|
||||
# based on their file location, for example enabling you to call `get` and
|
||||
# `post` in specs under `spec/controllers`.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue