Fixed specs

This commit is contained in:
Andres Keskküla 2014-10-01 11:34:12 +03:00
parent 78b534047c
commit af97dadfca
2 changed files with 18 additions and 19 deletions

View file

@ -12,8 +12,8 @@ Country.where(name: 'Latvia', iso: 'LV').first_or_create
zone = Registrar.where( zone = Registrar.where(
name: 'Zone Media OÜ', name: 'Zone Media OÜ',
reg_no: '10577829', reg_no: '10577829',
address: 'Lõõtsa 2, Tallinna linn, Harju maakond, 11415', address: 'Lõõtsa 2, Tallinna linn, Harju maakond, 11415'
country: Country.first #country: Country.first
).first_or_create ).first_or_create
EppUser.where(username: 'zone', password: 'ghyt9e4fu', active: true, registrar: zone).first_or_create EppUser.where(username: 'zone', password: 'ghyt9e4fu', active: true, registrar: zone).first_or_create
@ -21,12 +21,14 @@ EppUser.where(username: 'zone', password: 'ghyt9e4fu', active: true, registrar:
elkdata = Registrar.where( elkdata = Registrar.where(
name: 'Elkdata OÜ', name: 'Elkdata OÜ',
reg_no: '10510593', reg_no: '10510593',
address: 'Tondi 51-10, 11316 Tallinn', address: 'Tondi 51-10, 11316 Tallinn'
country: Country.first #country: Country.first
).first_or_create ).first_or_create
EppUser.where(username: 'elkdata', password: '8932iods', active: true, registrar: elkdata).first_or_create EppUser.where(username: 'elkdata', password: '8932iods', active: true, registrar: elkdata).first_or_create
User.where(username: 'gitlab', password: '12345', email: 'enquiries@gitlab.eu', admin: true, identity_code: '37810013855').first_or_create User.where(username: 'gitlab', password: '12345', email: 'enquiries@gitlab.eu', admin: true, identity_code: '37810013855', country: Country.where(name: 'Estonia').first).first_or_create
User.where(username: 'zone', password: '54321', email: 'info-info@zone.ee', admin: false, identity_code: '37810010085', registrar_id: zone.id).first_or_create User.where(username: 'zone', password: '54321', email: 'info-info@zone.ee', admin: false, identity_code: '37810010085',
User.where(username: 'elkdata', password: '32154', email: 'info-info@elkdata.ee', admin: false, identity_code: '37810010727', registrar_id: elkdata.id).first_or_create registrar_id: zone.id, country: Country.where(name: 'Estonia').first).first_or_create
User.where(username: 'elkdata', password: '32154', email: 'info-info@elkdata.ee', admin: false, identity_code: '37810010727',
registrar_id: elkdata.id, country: Country.where(name: 'Estonia').first).first_or_create

View file

@ -9,8 +9,8 @@ describe 'EPP Contact', epp: true do
context 'with valid user' do context 'with valid user' do
before(:each) do before(:each) do
Fabricate(:epp_user) Fabricate(:epp_user)
#Fabricate(:epp_user, username: 'zone', registrar: zone) Fabricate(:epp_user, username: 'zone', registrar: zone)
#Fabricate(:epp_user, username: 'elkdata', registrar: elkdata) Fabricate(:epp_user, username: 'elkdata', registrar: elkdata)
Fabricate(:domain_validation_setting_group) Fabricate(:domain_validation_setting_group)
end end
@ -34,7 +34,7 @@ describe 'EPP Contact', epp: true do
expect(response[:result_code]).to eq('1000') expect(response[:result_code]).to eq('1000')
expect(response[:msg]).to eq('Command completed successfully') expect(response[:msg]).to eq('Command completed successfully')
#expect(response[:clTRID]).to eq('ABC-12345') #expect(response[:clTRID]).to eq('ABC-12345')
expect(Contact.first.created_by_id).to eq 1 expect(Contact.first.created_by_id).to eq 2
expect(Contact.first.updated_by_id).to eq nil expect(Contact.first.updated_by_id).to eq nil
expect(Contact.count).to eq(1) expect(Contact.count).to eq(1)
@ -105,13 +105,13 @@ describe 'EPP Contact', epp: true do
end end
it 'stamps updated_by succesfully' do it 'stamps updated_by succesfully' do
Fabricate(:contact, code: 'sh8013', created_by_id: EppUser.first.id) Fabricate(:contact, code: 'sh8013', created_by_id: zone.id)
expect(Contact.first.updated_by_id).to be nil expect(Contact.first.updated_by_id).to be nil
epp_request(contact_update_xml, :xml) epp_request(contact_update_xml, :xml)
expect(Contact.first.updated_by_id).to eq 1 expect(Contact.first.updated_by_id).to eq 2
end end
it 'is succesful' do it 'is succesful' do
@ -174,13 +174,10 @@ describe 'EPP Contact', epp: true do
end end
it 'fails if contact has associated domain' do it 'fails if contact has associated domain' do
<<<<<<< HEAD Fabricate(:domain, owner_contact: Fabricate(:contact, code: 'dwa1234', created_by_id: zone.id), registrar: zone)
Fabricate(:domain, owner_contact: Fabricate(:contact, code: 'dwa1234', created_by_id: EppUser.first.id), registrar: zone) #Fabricate(:domain,
======= # registrar: elkdata,
Fabricate(:domain, # owner_contact: Fabricate(:contact, code: 'dwa1234', created_by_id: EppUser.first.id))
registrar: elkdata,
owner_contact: Fabricate(:contact, code: 'dwa1234', created_by_id: EppUser.first.id))
>>>>>>> reworked contact tests
expect(Domain.first.owner_contact.address.present?).to be true expect(Domain.first.owner_contact.address.present?).to be true
response = epp_request('contacts/delete.xml') response = epp_request('contacts/delete.xml')