-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Artur Beljajev
committed
Mar 9, 2017
1 parent
5dd981d
commit a5c4cd6
Showing
1 changed file
with
49 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
require 'rails_helper' | ||
|
||
RSpec.describe 'EPP contact:delete' do | ||
let(:user) { create(:api_user, registrar: registrar) } | ||
let(:registrar) { create(:registrar) } | ||
let!(:registrant) { create(:registrant, registrar: registrar, code: 'TEST') } | ||
let(:request) { post '/epp/command/delete', frame: request_xml } | ||
let(:request_xml) { <<-XML | ||
<?xml version="1.0" encoding="UTF-8" standalone="no"?> | ||
<epp xmlns="https://epp.tld.ee/schema/epp-ee-1.0.xsd"> | ||
<command> | ||
<delete> | ||
<contact:delete xmlns:contact="https://epp.tld.ee/schema/contact-ee-1.1.xsd"> | ||
<contact:id>test</contact:id> | ||
</contact:delete> | ||
</delete> | ||
</command> | ||
</epp> | ||
XML | ||
} | ||
|
||
before do | ||
sign_in_to_epp_area(user: user) | ||
end | ||
|
||
context 'when contact is used' do | ||
let!(:domain) { create(:domain, registrant: registrant) } | ||
|
||
specify do | ||
request | ||
expect(response).to have_code_of(2305) | ||
end | ||
|
||
it 'does not delete contact' do | ||
expect { request }.to_not change { Contact.count } | ||
end | ||
end | ||
|
||
context 'when contact is not used' do | ||
specify do | ||
request | ||
expect(response).to have_code_of(1000) | ||
end | ||
|
||
it 'deletes contact' do | ||
expect { request }.to change { Contact.count }.from(1).to(0) | ||
end | ||
end | ||
end |