Skip to content

Commit

Permalink
Add EPP contact:delete used spec
Browse files Browse the repository at this point in the history
  • Loading branch information
Artur Beljajev committed Mar 9, 2017
1 parent 5dd981d commit a5c4cd6
Showing 1 changed file with 49 additions and 0 deletions.
49 changes: 49 additions & 0 deletions spec/requests/epp/contact/delete/used_spec.rb
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

0 comments on commit a5c4cd6

Please sign in to comment.