Fix tests

This commit is contained in:
Karl Erik Õunapuu 2020-10-16 12:33:50 +03:00
parent f2a1ee101b
commit 220e0d7993
No known key found for this signature in database
GPG key ID: C9DD647298A34764
6 changed files with 29 additions and 31 deletions

View file

@ -34,7 +34,7 @@ module Repp
end
if @errors.any?
render_success(data: { errors: @errors })
render_epp_error(:bad_request, @errors)
else
render_success(data: @successful)
end
@ -52,10 +52,11 @@ module Repp
domain = Domain.find_by(name: domain_name)
# rubocop:disable Style/AndOr
add_error("#{domain_name} does not exist") and return unless domain
valid_transfer_code = domain.transfer_code.eql?(transfer_code)
add_error("#{domain_name} transfer code is wrong") and return unless valid_transfer_code
# rubocop:enable Style/AndOr
unless domain.transfer_code.eql?(transfer_code)
add_error("#{domain_name} transfer code is wrong")
return
end
domain
end