mirror of
https://github.com/internetee/registry.git
synced 2025-05-17 09:57:23 +02:00
rubocop autocorret to get tests green
This commit is contained in:
parent
c0caf53878
commit
2d6ed7fa45
24 changed files with 105 additions and 112 deletions
|
@ -11,6 +11,7 @@ class Admin::ContactVersionsController < AdminController
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def set_contact
|
||||
@contact = Contact.find(params[:id])
|
||||
end
|
||||
|
|
|
@ -11,6 +11,7 @@ class Admin::DomainVersionsController < AdminController
|
|||
end
|
||||
|
||||
private
|
||||
|
||||
def set_domain
|
||||
@domain = Domain.find(params[:id])
|
||||
end
|
||||
|
|
|
@ -27,7 +27,7 @@ class Client::ContactsController < ClientController
|
|||
redirect_to [:client, @contact]
|
||||
else
|
||||
flash[:alert] = I18n.t('shared.failed_to_create_contact')
|
||||
render "new"
|
||||
render 'new'
|
||||
end
|
||||
end
|
||||
|
||||
|
|
|
@ -10,8 +10,7 @@ class SessionsController < Devise::SessionsController
|
|||
session[:current_user_registrar_id] = Registrar.first.id if @user.admin?
|
||||
|
||||
flash[:notice] = I18n.t('shared.welcome')
|
||||
sign_in_and_redirect @user, :event => :authentication
|
||||
return
|
||||
sign_in_and_redirect @user, event: :authentication
|
||||
# end
|
||||
end
|
||||
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
module ApplicationHelper
|
||||
def coffee_script_tag(&block)
|
||||
content_tag(:script, CoffeeScript.compile(capture(&block)).html_safe, :type => 'text/javascript')
|
||||
content_tag(:script, CoffeeScript.compile(capture(&block)).html_safe, type: 'text/javascript')
|
||||
end
|
||||
end
|
||||
|
|
|
@ -7,12 +7,12 @@ module Epp::DomainsHelper
|
|||
|
||||
if @domain.errors.any?
|
||||
handle_errors(@domain)
|
||||
raise ActiveRecord::Rollback and return
|
||||
fail ActiveRecord::Rollback and return
|
||||
end
|
||||
|
||||
unless @domain.save
|
||||
handle_errors(@domain)
|
||||
raise ActiveRecord::Rollback and return
|
||||
fail ActiveRecord::Rollback and return
|
||||
end
|
||||
|
||||
render '/epp/domains/create'
|
||||
|
@ -55,12 +55,12 @@ module Epp::DomainsHelper
|
|||
|
||||
if @domain.errors.any?
|
||||
handle_errors(@domain)
|
||||
raise ActiveRecord::Rollback and return
|
||||
fail ActiveRecord::Rollback and return
|
||||
end
|
||||
|
||||
unless @domain.save
|
||||
handle_errors(@domain)
|
||||
raise ActiveRecord::Rollback and return
|
||||
fail ActiveRecord::Rollback and return
|
||||
end
|
||||
|
||||
render '/epp/domains/success'
|
||||
|
|
|
@ -2,8 +2,7 @@ class Ability
|
|||
include CanCan::Ability
|
||||
|
||||
def initialize(user)
|
||||
|
||||
alias_action :create, :read, :update, :destroy, :to => :crud
|
||||
alias_action :create, :read, :update, :destroy, to: :crud
|
||||
|
||||
user ||= User.new
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ module EppErrors
|
|||
|
||||
epp_errors = []
|
||||
send(key).each do |x|
|
||||
x.errors.messages.each do |key, values|
|
||||
x.errors.messages.each do |_key, values|
|
||||
epp_errors << x.collect_parent_errors(values)
|
||||
end
|
||||
end if multi.include?(macro)
|
||||
|
|
|
@ -18,7 +18,5 @@ module UserEvents
|
|||
def epp_user_events(id)
|
||||
where(whodunnit: "#{id}-EppUser")
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
|
|
|
@ -97,7 +97,6 @@ class Contact < ActiveRecord::Base
|
|||
|
||||
# should use only in transaction
|
||||
def destroy_and_clean
|
||||
|
||||
if relations_with_domain?
|
||||
errors.add(:domains, :exist)
|
||||
return false
|
||||
|
|
|
@ -5,5 +5,4 @@ class ContactVersion < PaperTrail::Version
|
|||
|
||||
self.table_name = :contact_versions
|
||||
self.sequence_name = :contact_version_id_seq
|
||||
|
||||
end
|
||||
|
|
|
@ -118,7 +118,7 @@ class Domain < ActiveRecord::Base
|
|||
|
||||
def validate_nameserver_ips
|
||||
nameservers.each do |ns|
|
||||
next if !ns.hostname.end_with?(name)
|
||||
next unless ns.hostname.end_with?(name)
|
||||
next if ns.ipv4.present?
|
||||
errors.add(:nameservers, :invalid) if errors[:nameservers].blank?
|
||||
ns.errors.add(:ipv4, :blank)
|
||||
|
|
|
@ -71,7 +71,7 @@ class Epp::EppDomain < Domain
|
|||
|
||||
# TODO: Find out if there are any attributes that can be changed
|
||||
# if not, delete this method
|
||||
def parse_and_update_domain_attributes(parsed_frame)
|
||||
def parse_and_update_domain_attributes(_parsed_frame)
|
||||
# assign_attributes(self.class.parse_update_params_from_frame(parsed_frame))
|
||||
|
||||
errors.empty?
|
||||
|
|
|
@ -1,14 +1,13 @@
|
|||
class Registrar < ActiveRecord::Base
|
||||
belongs_to :country
|
||||
has_many :domains, :dependent => :restrict_with_error
|
||||
has_many :contacts, :dependent => :restrict_with_error
|
||||
has_many :epp_users, :dependent => :restrict_with_error
|
||||
has_many :users, :dependent => :restrict_with_error
|
||||
has_many :domains, dependent: :restrict_with_error
|
||||
has_many :contacts, dependent: :restrict_with_error
|
||||
has_many :epp_users, dependent: :restrict_with_error
|
||||
has_many :users, dependent: :restrict_with_error
|
||||
|
||||
validates :name, :reg_no, :address, :country, presence: true
|
||||
validates :name, :reg_no, uniqueness: true
|
||||
|
||||
|
||||
def domain_transfers
|
||||
at = DomainTransfer.arel_table
|
||||
DomainTransfer.where(
|
||||
|
|
|
@ -66,10 +66,10 @@ Rails.application.routes.draw do
|
|||
end
|
||||
|
||||
authenticated :user do
|
||||
root :to => 'admin/domains#index', :as => :authenticated_root
|
||||
root to: 'admin/domains#index', as: :authenticated_root
|
||||
end
|
||||
|
||||
root :to => redirect('login')
|
||||
root to: redirect('login')
|
||||
|
||||
# The priority is based upon order of creation: first created -> highest priority.
|
||||
# See how all your routes lay out with "rake routes".
|
||||
|
|
|
@ -2,9 +2,9 @@ desc 'Commands for whois'
|
|||
|
||||
desc 'generate whois files'
|
||||
task 'whois:generate' => :environment do
|
||||
Dir.mkdir("./tmp/whois") unless File.exists?("./tmp/whois") #a folder for ze stuff
|
||||
Dir.mkdir('./tmp/whois') unless File.exist?('./tmp/whois') # a folder for ze stuff
|
||||
|
||||
alphabet = (("a".."z").to_a << %w(ö õ ü ä) ).flatten!
|
||||
alphabet = (('a'..'z').to_a << %w(ö õ ü ä)).flatten!
|
||||
@domains = {}
|
||||
alphabet.each do |letter|
|
||||
domains = Domain.where(['name LIKE ?', "#{letter}%"])
|
||||
|
@ -27,4 +27,3 @@ task 'whois:generate' => :environment do
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
|
|
@ -273,7 +273,7 @@ describe 'EPP Domain', epp: true do
|
|||
xml = domain_create_xml({
|
||||
ns: [
|
||||
{ hostObj: { value: 'invalid1-' } },
|
||||
{ hostObj: { value: '-invalid2' } },
|
||||
{ hostObj: { value: '-invalid2' } }
|
||||
]
|
||||
|
||||
})
|
||||
|
@ -580,12 +580,12 @@ describe 'EPP Domain', epp: true do
|
|||
expect(inf_data.css('status').first[:s]).to eq('clientHold')
|
||||
expect(inf_data.css('registrant').text).to eq(d.owner_contact_code)
|
||||
|
||||
admin_contacts_from_request = inf_data.css('contact[type="admin"]').map { |x| x.text }
|
||||
admin_contacts_from_request = inf_data.css('contact[type="admin"]').map(&:text)
|
||||
admin_contacts_existing = d.admin_contacts.pluck(:code)
|
||||
|
||||
expect(admin_contacts_from_request).to eq(admin_contacts_existing)
|
||||
|
||||
hosts_from_request = inf_data.css('hostObj').map { |x| x.text }
|
||||
hosts_from_request = inf_data.css('hostObj').map(&:text)
|
||||
hosts_existing = d.nameservers.where(ipv4: nil).pluck(:hostname)
|
||||
|
||||
expect(hosts_from_request).to eq(hosts_existing)
|
||||
|
|
|
@ -452,7 +452,6 @@ describe 'EPP Helper', epp: true do
|
|||
generated = Nokogiri::XML(domain_delete_xml).to_s.squish
|
||||
expect(generated).to eq(expected)
|
||||
|
||||
|
||||
expected = Nokogiri::XML('<?xml version="1.0" encoding="UTF-8" standalone="no"?>
|
||||
<epp xmlns="urn:ietf:params:xml:ns:epp-1.0">
|
||||
<command>
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue