Contact fabricator code made dynamic

This commit is contained in:
Andres Keskküla 2014-08-11 16:08:18 +03:00
parent 2f0b0c35d4
commit a01f03a6d5
5 changed files with 11 additions and 11 deletions

View file

@ -59,7 +59,7 @@ describe 'EPP Contact', epp: true do
#TODO tests for missing/invalid/etc ident #TODO tests for missing/invalid/etc ident
it 'deletes contact' do it 'deletes contact' do
Fabricate(:contact) Fabricate(:contact, code: "dwa1234")
response = epp_request('contacts/delete.xml') response = epp_request('contacts/delete.xml')
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')
@ -75,7 +75,7 @@ describe 'EPP Contact', epp: true do
end end
it 'checks contacts' do it 'checks contacts' do
Fabricate(:contact) Fabricate(:contact, code: 'check-1234')
response = epp_request('contacts/check.xml') response = epp_request('contacts/check.xml')
expect(response[:result_code]).to eq('1000') expect(response[:result_code]).to eq('1000')
@ -85,8 +85,8 @@ describe 'EPP Contact', epp: true do
expect(ids[0].attributes['avail'].text).to eq('0') expect(ids[0].attributes['avail'].text).to eq('0')
expect(ids[1].attributes['avail'].text).to eq('1') expect(ids[1].attributes['avail'].text).to eq('1')
expect(ids[0].text).to eq('sh8913') expect(ids[0].text).to eq('check-1234')
expect(ids[1].text).to eq('sh8914') expect(ids[1].text).to eq('check-4321')
end end
@ -97,7 +97,7 @@ describe 'EPP Contact', epp: true do
end end
it 'returns info about contact' do it 'returns info about contact' do
Fabricate(:contact, name: "Johnny Awesome", created_by_id: '1') Fabricate(:contact, name: "Johnny Awesome", created_by_id: '1', code: 'info-4444')
Fabricate(:address) Fabricate(:address)
response = epp_request('contacts/info.xml') response = epp_request('contacts/info.xml')
@ -110,7 +110,7 @@ describe 'EPP Contact', epp: true do
end end
it 'it doesn\'t display unassociated object' do it 'it doesn\'t display unassociated object' do
Fabricate(:contact, name:"Johnny Awesome", created_by_id: '240') Fabricate(:contact, name:"Johnny Awesome", created_by_id: '240', code: 'info-4444')
Fabricate(:epp_user, id: 240) Fabricate(:epp_user, id: 240)
response = epp_request('contacts/info.xml') response = epp_request('contacts/info.xml')

View file

@ -4,8 +4,8 @@
<check> <check>
<contact:check <contact:check
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>sh8913</contact:id> <contact:id>check-1234</contact:id>
<contact:id>sh8914</contact:id> <contact:id>check-4321</contact:id>
</contact:check> </contact:check>
</check> </check>
<clTRID>ABC-12345</clTRID> <clTRID>ABC-12345</clTRID>

View file

@ -4,7 +4,7 @@
<delete> <delete>
<contact:delete <contact:delete
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>sh8913</contact:id> <contact:id>dwa1234</contact:id>
</contact:delete> </contact:delete>
</delete> </delete>
<clTRID>ABC-12345</clTRID> <clTRID>ABC-12345</clTRID>

View file

@ -4,7 +4,7 @@
<info> <info>
<contact:info <contact:info
xmlns:contact="urn:ietf:params:xml:ns:contact-1.0"> xmlns:contact="urn:ietf:params:xml:ns:contact-1.0">
<contact:id>sh8913</contact:id> <contact:id>info-4444</contact:id>
<contact:authInfo> <contact:authInfo>
<contact:pw>2fooBAR</contact:pw> <contact:pw>2fooBAR</contact:pw>
</contact:authInfo> </contact:authInfo>

View file

@ -3,7 +3,7 @@ Fabricator(:contact) do
phone '+372.12345678' phone '+372.12345678'
email Faker::Internet.email email Faker::Internet.email
ident '37605030299' ident '37605030299'
code 'sh8913' code "sh#{Faker::Number.number(4)}"
ident_type 'op' ident_type 'op'
address address
end end