mirror of
https://github.com/internetee/registry.git
synced 2025-08-04 00:42:04 +02:00
Merge branch 'master' into registry-268
This commit is contained in:
commit
ba53ae90a7
27 changed files with 164 additions and 80 deletions
|
@ -10,8 +10,13 @@ FactoryGirl.define do
|
|||
end
|
||||
|
||||
factory :api_user_with_unlimited_balance do
|
||||
after :build do |api_user|
|
||||
api_user.registrar = create(:registrar_with_unlimited_balance)
|
||||
transient do
|
||||
registrar false
|
||||
end
|
||||
|
||||
after :build do |api_user, evaluator|
|
||||
registrar = (evaluator.registrar || create(:registrar_with_unlimited_balance))
|
||||
api_user.registrar = registrar
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
52
spec/features/registrar/contacts/delete_spec.rb
Normal file
52
spec/features/registrar/contacts/delete_spec.rb
Normal file
|
@ -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
|
|
@ -8,10 +8,10 @@ RSpec.describe 'registrar/contacts/_form' do
|
|||
assign(:contact, contact)
|
||||
|
||||
stub_template 'registrar/shared/_error_messages' => ''
|
||||
stub_template 'registrar/contacts/form_partials/_general' => ''
|
||||
stub_template 'registrar/contacts/form_partials/_address' => 'address info'
|
||||
stub_template 'registrar/contacts/form_partials/_code' => ''
|
||||
stub_template 'registrar/contacts/form_partials/_legal_document' => ''
|
||||
stub_template 'registrar/contacts/form/_general' => ''
|
||||
stub_template 'registrar/contacts/form/_address' => 'address info'
|
||||
stub_template 'registrar/contacts/form/_code' => ''
|
||||
stub_template 'registrar/contacts/form/_legal_document' => ''
|
||||
end
|
||||
|
||||
context 'when address processing is enabled' do
|
||||
|
|
|
@ -0,0 +1,15 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'registrar/contacts/form/_legal_document' do
|
||||
let(:contact) { instance_spy(Depp::Contact) }
|
||||
|
||||
before :example do
|
||||
allow(view).to receive(:f).and_return(DefaultFormBuilder.new(:depp_contact, contact, view, {}))
|
||||
assign(:contact, contact)
|
||||
end
|
||||
|
||||
it 'has legal document' do
|
||||
render
|
||||
expect(rendered).to have_css('[name="depp_contact[legal_document]"]')
|
||||
end
|
||||
end
|
20
spec/views/registrar/domains/_form.haml_spec.rb
Normal file
20
spec/views/registrar/domains/_form.haml_spec.rb
Normal file
|
@ -0,0 +1,20 @@
|
|||
require 'rails_helper'
|
||||
|
||||
RSpec.describe 'registrar/domains/_form' do
|
||||
let(:domain) { instance_spy(Depp::Domain) }
|
||||
|
||||
before :example do
|
||||
allow(view).to receive(:f).and_return(DefaultFormBuilder.new(:domain, domain, view, {}))
|
||||
assign(:domain, domain)
|
||||
|
||||
stub_template 'registrar/domains/form/_general' => ''
|
||||
stub_template 'registrar/domains/form/_contacts' => ''
|
||||
stub_template 'registrar/domains/form/_nameservers' => ''
|
||||
stub_template 'registrar/domains/form/_dnskeys' => ''
|
||||
end
|
||||
|
||||
it 'has legal document' do
|
||||
render
|
||||
expect(rendered).to have_css('[name="domain[legal_document]"]')
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue