Merge pull request #2150 from internetee/ruby3-support

Ruby3 support
This commit is contained in:
Alex Sherman 2021-09-07 12:58:58 +05:00 committed by GitHub
commit eb03d1bdb1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 20 additions and 18 deletions

View file

@ -17,7 +17,7 @@ jobs:
fail-fast: false fail-fast: false
matrix: matrix:
os: [ubuntu-18.04] os: [ubuntu-18.04]
ruby: [ 2.7 ] ruby: [ 2.7, 3.0 ]
runs-on: ${{ matrix.os }} runs-on: ${{ matrix.os }}
continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }} continue-on-error: ${{ endsWith(matrix.ruby, 'head') || matrix.ruby == 'debug' }}
steps: steps:
@ -85,6 +85,10 @@ jobs:
path: coverage/codeclimate.${{ matrix.ruby }}.json path: coverage/codeclimate.${{ matrix.ruby }}.json
upload_coverage: upload_coverage:
strategy:
fail-fast: false
matrix:
ruby: [ 2.7, 3.0 ]
runs-on: ubuntu-18.04 runs-on: ubuntu-18.04
env: env:
@ -102,7 +106,7 @@ jobs:
- uses: actions/download-artifact@v2.0.10 - uses: actions/download-artifact@v2.0.10
with: with:
name: coverage-2.7 name: coverage-${{ matrix.ruby }}
path: coverage path: coverage
- name: Aggregate & upload results to Code Climate - name: Aggregate & upload results to Code Climate

View file

@ -1,4 +1,4 @@
FROM internetee/ruby:2.7-buster FROM internetee/ruby:3.0-buster
RUN mkdir -p /opt/webapps/app/tmp/pids RUN mkdir -p /opt/webapps/app/tmp/pids
WORKDIR /opt/webapps/app WORKDIR /opt/webapps/app

View file

@ -74,7 +74,7 @@ module Repp
render_epp_error render_epp_error
end end
def render_epp_error(status = :bad_request, data = {}) def render_epp_error(status = :bad_request, **data)
@epp_errors ||= ActiveModel::Errors.new(self) @epp_errors ||= ActiveModel::Errors.new(self)
@epp_errors.add(:epp_errors, msg: 'Command failed', code: '2304') if data != {} @epp_errors.add(:epp_errors, msg: 'Command failed', code: '2304') if data != {}

View file

@ -43,7 +43,7 @@ module Repp
return return
end end
render_success(create_update_success_body) render_success(**create_update_success_body)
end end
api :PUT, '/repp/v1/contacts/:contact_code' api :PUT, '/repp/v1/contacts/:contact_code'
@ -58,7 +58,7 @@ module Repp
return return
end end
render_success(create_update_success_body) render_success(**create_update_success_body)
end end
api :DELETE, '/repp/v1/contacts/:contact_code' api :DELETE, '/repp/v1/contacts/:contact_code'

View file

@ -11,9 +11,7 @@ module Domains
renewed_expire_time = prepare_renewed_expire_time renewed_expire_time = prepare_renewed_expire_time
in_transaction_with_retries do in_transaction_with_retries do
check_balance check_balance
success = domain.renew(renewed_expire_time: renewed_expire_time, success = domain.renew(renewed_expire_time, period, unit)
period: period,
unit: unit)
if success if success
check_balance check_balance
reduce_balance reduce_balance

View file

@ -12,9 +12,9 @@ class DomainExpireEmailJob < ApplicationJob
} }
if domain.force_delete_scheduled? if domain.force_delete_scheduled?
DomainExpireMailer.expired_soft(attrs).deliver_now DomainExpireMailer.expired_soft(**attrs).deliver_now
else else
DomainExpireMailer.expired(attrs).deliver_now DomainExpireMailer.expired(**attrs).deliver_now
end end
end end
end end

View file

@ -121,7 +121,7 @@ module EppErrors
err = { code: code, msg: t } err = { code: code, msg: t }
val = check_for_status(code, obj, val) val = check_for_status(code, obj, val)
err[:value] = { val: val, obj: obj } if val.present? err[:value] = { val: val, obj: obj } if val.present?
self.errors.add(:epp_errors, err) self.errors.add(:epp_errors, **err)
end end
def check_for_status(code, obj, val) def check_for_status(code, obj, val)

View file

@ -173,7 +173,7 @@ class Epp::Domain < Domain
### RENEW ### ### RENEW ###
def renew(renewed_expire_time:, period:, unit:) def renew(renewed_expire_time, period, unit)
@is_renewal = true @is_renewal = true
add_renew_epp_errors unless renewable? add_renew_epp_errors unless renewable?

View file

@ -7,6 +7,6 @@ class DomainNameserverValidator < ActiveModel::EachValidator
return if values.size.between?(min, max) return if values.size.between?(min, max)
association = options[:association] || attribute association = options[:association] || attribute
record.errors.add(association, :out_of_range, { min: min, max: max }) record.errors.add(association, :out_of_range, **{ min: min, max: max })
end end
end end

View file

@ -5,6 +5,6 @@ class ObjectCountValidator < ActiveModel::EachValidator
return if values.size.between?(min, max) return if values.size.between?(min, max)
association = options[:association] || attribute association = options[:association] || attribute
record.errors.add(association, :out_of_range, { min: min, max: max }) record.errors.add(association, :out_of_range, **{ min: min, max: max })
end end
end end

View file

@ -6,7 +6,7 @@ module I18n
def localize(object, options = {}) def localize(object, options = {})
options.merge!({ default: '-' }) options.merge!({ default: '-' })
object.present? ? original_localize(object, options) : '' object.present? ? original_localize(object, **options) : ''
end end
end end
end end

View file

@ -55,7 +55,7 @@ class AdminAreaBankStatementTest < ApplicationSystemTestCase
def test_can_bind_statement_transactions def test_can_bind_statement_transactions
registrar = registrars(:bestnames) registrar = registrars(:bestnames)
registrar.issue_prepayment_invoice(amount: 500) registrar.issue_prepayment_invoice(500)
invoice = registrar.invoices.last invoice = registrar.invoices.last
create_bank_statement create_bank_statement