mirror of
https://github.com/internetee/registry.git
synced 2025-05-29 17:10:08 +02:00
Add domain name search test #2122
This commit is contained in:
parent
9aa54a897e
commit
174d632bc9
4 changed files with 60 additions and 2 deletions
|
@ -2,6 +2,9 @@ class Admin::DomainsController < AdminController
|
||||||
load_and_authorize_resource
|
load_and_authorize_resource
|
||||||
before_action :set_domain, only: [:show, :edit, :update, :zonefile]
|
before_action :set_domain, only: [:show, :edit, :update, :zonefile]
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
|
# rubocop: disable Metrics/AbcSize
|
||||||
def index
|
def index
|
||||||
params[:q] ||= {}
|
params[:q] ||= {}
|
||||||
if params[:statuses_contains]
|
if params[:statuses_contains]
|
||||||
|
@ -29,6 +32,9 @@ class Admin::DomainsController < AdminController
|
||||||
|
|
||||||
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
@domains = @domains.per(params[:results_per_page]) if params[:results_per_page].to_i > 0
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
|
# rubocop: enable Metrics/AbcSize
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@domain.valid?
|
@domain.valid?
|
||||||
|
|
|
@ -18,8 +18,8 @@
|
||||||
= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident)
|
= f.search_field :contacts_ident_eq, class: 'form-control', placeholder: t(:contact_ident)
|
||||||
.col-md-3
|
.col-md-3
|
||||||
.form-group
|
.form-group
|
||||||
= f.label t(:nameserver)
|
= f.label t(:nameserver_hostname)
|
||||||
= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver)
|
= f.search_field :nameservers_hostname_eq, class: 'form-control', placeholder: t(:nameserver_hostname)
|
||||||
.row
|
.row
|
||||||
.col-md-6
|
.col-md-6
|
||||||
.form-group
|
.form-group
|
||||||
|
|
|
@ -891,3 +891,4 @@ en:
|
||||||
registrant_ident: 'Registrant ident'
|
registrant_ident: 'Registrant ident'
|
||||||
contact_ident: 'Contact ident'
|
contact_ident: 'Contact ident'
|
||||||
results_per_page: 'Results per page'
|
results_per_page: 'Results per page'
|
||||||
|
nameserver_hostname: 'Nameserver hostname'
|
||||||
|
|
51
spec/features/admin/domain_spec.rb
Normal file
51
spec/features/admin/domain_spec.rb
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
require 'rails_helper'
|
||||||
|
|
||||||
|
feature 'Domain', type: :feature do
|
||||||
|
before :all do
|
||||||
|
@user = Fabricate(:admin_user)
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should show index of domains' do
|
||||||
|
Fabricate(:domain, name: 'testing.ee')
|
||||||
|
sign_in @user
|
||||||
|
visit admin_domains_url
|
||||||
|
|
||||||
|
page.should have_content('testing.ee')
|
||||||
|
end
|
||||||
|
|
||||||
|
it 'should search domains by name' do
|
||||||
|
d1 = Fabricate(:domain, name: 'abcde.ee')
|
||||||
|
Fabricate(:domain, name: 'abcdee.ee')
|
||||||
|
Fabricate(:domain, name: 'defgh.pri.ee')
|
||||||
|
sign_in @user
|
||||||
|
visit admin_domains_url
|
||||||
|
|
||||||
|
page.should have_content('abcde.ee')
|
||||||
|
page.should have_content('abcdee.ee')
|
||||||
|
page.should have_content('defgh.pri.ee')
|
||||||
|
|
||||||
|
fill_in 'q_name_matches', with: 'abcde.ee'
|
||||||
|
find('.btn.btn-primary').click
|
||||||
|
|
||||||
|
current_path.should == "/admin/domains/#{d1.id}"
|
||||||
|
|
||||||
|
visit admin_domains_url
|
||||||
|
fill_in 'q_name_matches', with: '.ee'
|
||||||
|
find('.btn.btn-primary').click
|
||||||
|
|
||||||
|
current_path.should == "/admin/domains"
|
||||||
|
page.should have_content('abcde.ee')
|
||||||
|
page.should have_content('abcdee.ee')
|
||||||
|
page.should have_content('defgh.pri.ee')
|
||||||
|
|
||||||
|
fill_in 'q_name_matches', with: 'abcd%.ee'
|
||||||
|
find('.btn.btn-primary').click
|
||||||
|
page.should have_content('abcde.ee')
|
||||||
|
page.should have_content('abcdee.ee')
|
||||||
|
page.should_not have_content('defgh.pri.ee')
|
||||||
|
|
||||||
|
fill_in 'q_name_matches', with: 'abcd_.ee'
|
||||||
|
find('.btn.btn-primary').click
|
||||||
|
current_path.should == "/admin/domains/#{d1.id}"
|
||||||
|
end
|
||||||
|
end
|
Loading…
Add table
Add a link
Reference in a new issue