-
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.
Add registrar area contact delete spec
- Loading branch information
Artur Beljajev
committed
Mar 5, 2017
1 parent
faeb784
commit 09d15a2
Showing
1 changed file
with
52 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,52 @@ | ||
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) | ||
Setting.api_ip_whitelist_enabled = false | ||
Setting.registrar_ip_whitelist_enabled = false | ||
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 |