-
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.
Merge branch 'master' into registry-268
- Loading branch information
Showing
27 changed files
with
164 additions
and
80 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
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,6 @@ | ||
class DefaultFormBuilder < ActionView::Helpers::FormBuilder | ||
def legal_document_field(method, options = {}) | ||
self.multipart = true | ||
@template.legal_document_field(@object_name, method, objectify_options(options)) | ||
end | ||
end |
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,8 @@ | ||
module FormHelper | ||
def legal_document_field(object_name, method, options = {}) | ||
options[:data] = { legal_document: true } | ||
options[:accept] = legal_document_types unless options[:accept] | ||
|
||
file_field(object_name, method, options) | ||
end | ||
end |
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,8 @@ | ||
module FormTagHelper | ||
def legal_document_field_tag(name, options = {}) | ||
options[:data] = { legal_document: true } | ||
options[:accept] = legal_document_types unless options[:accept] | ||
|
||
file_field_tag(name, options) | ||
end | ||
end |
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 |
---|---|---|
|
@@ -3,20 +3,20 @@ | |
= f.hidden_field :password | ||
.row | ||
.col-md-8 | ||
= render 'registrar/contacts/form_partials/general', f: f | ||
= render 'registrar/contacts/form/general', f: f | ||
|
||
- if address_processing? | ||
.row | ||
.col-md-8 | ||
= render 'registrar/contacts/form_partials/address', f: f | ||
= render 'registrar/contacts/form/address', f: f | ||
|
||
- if [email protected]? | ||
.row | ||
.col-md-8 | ||
= render 'registrar/contacts/form_partials/code', f: f | ||
= render 'registrar/contacts/form/code', f: f | ||
.row | ||
.col-md-8 | ||
= render 'registrar/contacts/form_partials/legal_document', f: f | ||
= render 'registrar/contacts/form/legal_document', f: f | ||
|
||
.row | ||
.col-md-8.text-right | ||
|
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
File renamed without changes.
File renamed without changes.
File renamed without changes.
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
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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
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
File renamed without changes.
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
File renamed without changes.
File renamed without changes.
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
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
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,6 @@ | ||
en: | ||
registrar: | ||
contacts: | ||
partials: | ||
domains: | ||
roles: Roles |
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
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
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 |
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
15 changes: 15 additions & 0 deletions
15
spec/views/registrar/contacts/form/_legal_document.haml_spec.rb
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,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 |
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,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 |