mirror of
https://github.com/internetee/registry.git
synced 2025-07-21 18:26:06 +02:00
Fix tests #2741
This commit is contained in:
parent
36e4f2ddc9
commit
7eb509b9a8
2 changed files with 8 additions and 4 deletions
|
@ -18,16 +18,18 @@ class Epp::DomainsController < EppController
|
||||||
render_epp_response '/epp/domains/info'
|
render_epp_response '/epp/domains/info'
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# rubocop: disable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: disable Metrics/CyclomaticComplexity
|
||||||
def create
|
def create
|
||||||
authorize! :create, Epp::Domain
|
authorize! :create, Epp::Domain
|
||||||
@domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user)
|
@domain = Epp::Domain.new_from_epp(params[:parsed_frame], current_user)
|
||||||
@domain.valid?
|
|
||||||
|
|
||||||
handle_errors(@domain) and return if @domain.errors.any?
|
handle_errors(@domain) and return if @domain.errors.any?
|
||||||
|
handle_errors(@domain) and return if @domain.valid? && @domain.errors.any?
|
||||||
|
|
||||||
handle_errors and return unless balance_ok?('create')
|
handle_errors and return unless balance_ok?('create')
|
||||||
|
|
||||||
ActiveRecord::Base.transaction do
|
ActiveRecord::Base.transaction do
|
||||||
if @domain.save
|
if @domain.save # TODO: Maybe use validate: false here because we have already validated the domain?
|
||||||
current_user.registrar.debit!(@domain_price, "#{I18n.t('create')} #{@domain.name}")
|
current_user.registrar.debit!(@domain_price, "#{I18n.t('create')} #{@domain.name}")
|
||||||
render_epp_response '/epp/domains/create'
|
render_epp_response '/epp/domains/create'
|
||||||
else
|
else
|
||||||
|
@ -35,6 +37,8 @@ class Epp::DomainsController < EppController
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
# rubocop: enable Metrics/PerceivedComplexity
|
||||||
|
# rubocop: enable Metrics/CyclomaticComplexity
|
||||||
|
|
||||||
def update
|
def update
|
||||||
authorize! :update, @domain, @password
|
authorize! :update, @domain, @password
|
||||||
|
|
|
@ -55,7 +55,7 @@ describe Pricelist do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have name' do
|
it 'should have name' do
|
||||||
@pricelist.name.should == 'new .ee'
|
@pricelist.name.should == 'create ee'
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should have one version' do
|
it 'should have one version' do
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue