internetee-registry/spec/features/registrar/contacts/delete_spec.rb
Artur Beljajev 76d10b94c5 Turn off settings by default
- `registrar_ip_whitelist_enabled`
- `api_ip_whitelist_enabled`
2018-06-06 04:55:36 +03:00

50 lines
895 B
Ruby

require 'rails_helper'
class FakeDeppContact
include ActiveModel::Model
def id
'test'
end
def name
'test'
end
def persisted?
true
end
def password
'test'
end
def delete
true
end
end
RSpec.feature 'Contact deletion in registrar area' do
given!(:registrar) { create(:registrar) }
given!(:contact) { create(:contact, registrar: registrar) }
background do
allow(Depp::Contact).to receive(:find_by_id).and_return(FakeDeppContact.new)
allow(Depp::Contact).to receive(:new).and_return(FakeDeppContact.new)
sign_in_to_registrar_area(user: create(:api_user_with_unlimited_balance, registrar: registrar))
end
it 'deletes contact' do
visit registrar_contacts_url
click_link_or_button 'Delete'
confirm
expect(page).to have_text('Destroyed')
end
private
def confirm
click_link_or_button 'Delete'
end
end