mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 02:05:57 +02:00
Rubocop autocorrect
This commit is contained in:
parent
f8c48a7456
commit
6c5c0b38c8
59 changed files with 533 additions and 546 deletions
|
@ -1,22 +1,19 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Address do
|
||||
it { should belong_to(:contact) }
|
||||
it { should belong_to(:country) }
|
||||
end
|
||||
|
||||
|
||||
describe Address, '.extract_params' do
|
||||
it 'returns params hash'do
|
||||
Fabricate(:country, iso:'EE')
|
||||
ph = { postalInfo: { name: "fred", addr: { cc: 'EE', city: 'Village', street: [ 'street1', 'street2' ] } } }
|
||||
expect(Address.extract_attributes(ph[:postalInfo][:addr])).to eq( {
|
||||
Fabricate(:country, iso: 'EE')
|
||||
ph = { postalInfo: { name: 'fred', addr: { cc: 'EE', city: 'Village', street: %w(street1 street2) } } }
|
||||
expect(Address.extract_attributes(ph[:postalInfo][:addr])).to eq({
|
||||
city: 'Village',
|
||||
country_id: 1,
|
||||
street: 'street1',
|
||||
street2: 'street2'
|
||||
} )
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Contact do
|
||||
it { should have_one(:address) }
|
||||
|
@ -7,12 +7,12 @@ describe Contact do
|
|||
before(:each) { @contact = Fabricate(:contact) }
|
||||
|
||||
it 'phone should return false' do
|
||||
@contact.phone = "32341"
|
||||
@contact.phone = '32341'
|
||||
expect(@contact.valid?).to be false
|
||||
end
|
||||
|
||||
it 'ident should return false' do
|
||||
@contact.ident = "123abc"
|
||||
@contact.ident = '123abc'
|
||||
expect(@contact.valid?).to be false
|
||||
end
|
||||
|
||||
|
@ -21,11 +21,11 @@ describe Contact do
|
|||
expect(@contact.valid?).to eq false
|
||||
|
||||
expect(@contact.errors.messages).to match_array({
|
||||
:code=>["Required parameter missing - code"],
|
||||
:name=>["Required parameter missing - name"],
|
||||
:phone=>["Required parameter missing - phone", "Phone nr is invalid"],
|
||||
:email=>["Required parameter missing - email", "Email is invalid"],
|
||||
:ident=>["Required parameter missing - ident"]
|
||||
code: ['Required parameter missing - code'],
|
||||
name: ['Required parameter missing - name'],
|
||||
phone: ['Required parameter missing - phone', 'Phone nr is invalid'],
|
||||
email: ['Required parameter missing - email', 'Email is invalid'],
|
||||
ident: ['Required parameter missing - ident']
|
||||
})
|
||||
end
|
||||
end
|
||||
|
@ -41,7 +41,7 @@ end
|
|||
|
||||
describe Contact, '#relations_with_domain?' do
|
||||
context 'with no relation' do
|
||||
before(:each) { Fabricate(:contact) }
|
||||
before(:each) { Fabricate(:contact) }
|
||||
it 'should return false' do
|
||||
expect(Contact.first.relations_with_domain?).to be false
|
||||
end
|
||||
|
@ -52,7 +52,7 @@ describe Contact, '#relations_with_domain?' do
|
|||
Fabricate(:domain_validation_setting_group)
|
||||
Fabricate(:domain)
|
||||
end
|
||||
|
||||
|
||||
it 'should return true' do
|
||||
expect(Contact.first.relations_with_domain?).to be true
|
||||
end
|
||||
|
@ -60,7 +60,7 @@ describe Contact, '#relations_with_domain?' do
|
|||
end
|
||||
|
||||
describe Contact, '#crID' do
|
||||
before(:each) { Fabricate(:contact, code: "asd12", created_by: Fabricate(:epp_user)) }
|
||||
before(:each) { Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user)) }
|
||||
|
||||
it 'should return username of creator' do
|
||||
expect(Contact.first.crID).to eq('gitlab')
|
||||
|
@ -71,9 +71,8 @@ describe Contact, '#crID' do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
describe Contact, '#upID' do
|
||||
before(:each) { Fabricate(:contact, code: "asd12", created_by: Fabricate(:epp_user), updated_by: Fabricate(:epp_user)) }
|
||||
before(:each) { Fabricate(:contact, code: 'asd12', created_by: Fabricate(:epp_user), updated_by: Fabricate(:epp_user)) }
|
||||
|
||||
it 'should return username of updater' do
|
||||
expect(Contact.first.upID).to eq('gitlab')
|
||||
|
@ -84,45 +83,42 @@ describe Contact, '#upID' do
|
|||
end
|
||||
end
|
||||
|
||||
|
||||
describe Contact, '.extract_params' do
|
||||
it 'returns params hash'do
|
||||
ph = { id: '123123', email: 'jdoe@example.com', postalInfo: { name: "fred", addr: { cc: 'EE' } } }
|
||||
expect(Contact.extract_attributes(ph)).to eq( {
|
||||
ph = { id: '123123', email: 'jdoe@example.com', postalInfo: { name: 'fred', addr: { cc: 'EE' } } }
|
||||
expect(Contact.extract_attributes(ph)).to eq({
|
||||
code: '123123',
|
||||
email: 'jdoe@example.com',
|
||||
name: 'fred'
|
||||
} )
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
describe Contact, '.check_availability' do
|
||||
|
||||
before(:each) {
|
||||
Fabricate(:contact, code: "asd12")
|
||||
Fabricate(:contact, code: "asd13")
|
||||
}
|
||||
before(:each) do
|
||||
Fabricate(:contact, code: 'asd12')
|
||||
Fabricate(:contact, code: 'asd13')
|
||||
end
|
||||
|
||||
it 'should return array if argument is string' do
|
||||
response = Contact.check_availability("asd12")
|
||||
response = Contact.check_availability('asd12')
|
||||
expect(response.class).to be Array
|
||||
expect(response.length).to eq(1)
|
||||
end
|
||||
|
||||
it 'should return in_use and available codes' do
|
||||
response = Contact.check_availability(["asd12","asd13","asd14"])
|
||||
response = Contact.check_availability(%w(asd12 asd13 asd14))
|
||||
expect(response.class).to be Array
|
||||
expect(response.length).to eq(3)
|
||||
|
||||
expect(response[0][:avail]).to eq(0)
|
||||
expect(response[0][:code]).to eq("asd12")
|
||||
expect(response[0][:code]).to eq('asd12')
|
||||
|
||||
expect(response[1][:avail]).to eq(0)
|
||||
expect(response[1][:code]).to eq("asd13")
|
||||
expect(response[1][:code]).to eq('asd13')
|
||||
|
||||
expect(response[2][:avail]).to eq(1)
|
||||
expect(response[2][:code]).to eq("asd14")
|
||||
expect(response[2][:code]).to eq('asd14')
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Domain do
|
||||
it { should belong_to(:registrar) }
|
||||
it { should have_and_belong_to_many(:nameservers)}
|
||||
it { should have_and_belong_to_many(:nameservers) }
|
||||
it { should belong_to(:owner_contact) }
|
||||
it { should have_many(:tech_contacts) }
|
||||
it { should have_many(:admin_contacts) }
|
||||
|
@ -44,9 +44,9 @@ describe Domain do
|
|||
expect(d.errors.messages).to match_array({
|
||||
name: ['is missing'],
|
||||
period: ['is not a number'],
|
||||
owner_contact: ["Registrant is missing"],
|
||||
admin_contacts: ["Admin contact is missing"],
|
||||
nameservers: ["Nameservers count must be between 1-13"]
|
||||
owner_contact: ['Registrant is missing'],
|
||||
admin_contacts: ['Admin contact is missing'],
|
||||
nameservers: ['Nameservers count must be between 1-13']
|
||||
})
|
||||
|
||||
sg = SettingGroup.domain_validation
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe EppSession do
|
||||
let(:epp_session) { Fabricate(:epp_session) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe EppUser do
|
||||
it { should belong_to(:registrar) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Nameserver do
|
||||
it { should have_and_belong_to_many(:domains) }
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe NsSet do
|
||||
it { should belong_to(:registrar)}
|
||||
it { should belong_to(:registrar) }
|
||||
it { should have_and_belong_to_many(:nameservers) }
|
||||
end
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Registrar do
|
||||
it { should belong_to(:country) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Right do
|
||||
it { should have_and_belong_to_many(:roles) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Role do
|
||||
it { should have_and_belong_to_many(:rights) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe SettingGroup do
|
||||
it { should have_many(:settings) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe Setting do
|
||||
it { should belong_to(:setting_group) }
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
require "rails_helper"
|
||||
require 'rails_helper'
|
||||
|
||||
describe User do
|
||||
it { should belong_to(:role) }
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue