mirror of
https://github.com/internetee/registry.git
synced 2025-07-23 03:06:14 +02:00
Pump minitest version
This commit is contained in:
parent
c7593338e2
commit
4e1bec3613
7 changed files with 12 additions and 105 deletions
2
Gemfile
2
Gemfile
|
@ -84,8 +84,8 @@ end
|
||||||
group :test do
|
group :test do
|
||||||
gem 'capybara'
|
gem 'capybara'
|
||||||
gem 'database_cleaner'
|
gem 'database_cleaner'
|
||||||
|
gem 'minitest', '~> 5.14'
|
||||||
gem 'simplecov', require: false
|
gem 'simplecov', require: false
|
||||||
gem 'webdrivers'
|
gem 'webdrivers'
|
||||||
gem 'webmock'
|
gem 'webmock'
|
||||||
gem 'minitest', '~> 5.10.0'
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -250,7 +250,7 @@ GEM
|
||||||
rake
|
rake
|
||||||
mini_mime (1.0.2)
|
mini_mime (1.0.2)
|
||||||
mini_portile2 (2.4.0)
|
mini_portile2 (2.4.0)
|
||||||
minitest (5.10.3)
|
minitest (5.14.0)
|
||||||
monetize (1.9.4)
|
monetize (1.9.4)
|
||||||
money (~> 6.12)
|
money (~> 6.12)
|
||||||
money (6.13.7)
|
money (6.13.7)
|
||||||
|
@ -479,7 +479,7 @@ DEPENDENCIES
|
||||||
kaminari
|
kaminari
|
||||||
lhv!
|
lhv!
|
||||||
mina (= 0.3.1)
|
mina (= 0.3.1)
|
||||||
minitest (~> 5.10.0)
|
minitest (~> 5.14)
|
||||||
money-rails
|
money-rails
|
||||||
nokogiri
|
nokogiri
|
||||||
paper_trail (~> 4.0)
|
paper_trail (~> 4.0)
|
||||||
|
|
|
@ -23,7 +23,9 @@ class Contact < ApplicationRecord
|
||||||
accepts_nested_attributes_for :legal_documents
|
accepts_nested_attributes_for :legal_documents
|
||||||
|
|
||||||
validates :name, :email, presence: true
|
validates :name, :email, presence: true
|
||||||
validates :street, :city, :zip, :country_code, presence: true, if: -> { self.class.address_processing? }
|
validates :street, :city, :zip, :country_code, presence: true, if: lambda {
|
||||||
|
self.class.address_processing?
|
||||||
|
}
|
||||||
|
|
||||||
validates :phone, presence: true, e164: true, phone: true
|
validates :phone, presence: true, e164: true, phone: true
|
||||||
|
|
||||||
|
|
|
@ -9,15 +9,16 @@ class Dnskey < ApplicationRecord
|
||||||
validate :validate_protocol
|
validate :validate_protocol
|
||||||
validate :validate_flags
|
validate :validate_flags
|
||||||
|
|
||||||
before_save -> { generate_digest if will_save_change_to_public_key? &&
|
before_save lambda {
|
||||||
!will_save_change_to_ds_digest? }
|
generate_digest if will_save_change_to_public_key? && !will_save_change_to_ds_digest?
|
||||||
|
}
|
||||||
|
|
||||||
before_save lambda {
|
before_save lambda {
|
||||||
if (will_save_change_to_public_key? ||
|
if (will_save_change_to_public_key? ||
|
||||||
will_save_change_to_flags? ||
|
will_save_change_to_flags? ||
|
||||||
will_save_change_to_alg? ||
|
will_save_change_to_alg? ||
|
||||||
will_save_change_to_protocol?) &&
|
will_save_change_to_protocol?) &&
|
||||||
!will_save_change_to_ds_key_tag?
|
!will_save_change_to_ds_key_tag?
|
||||||
generate_ds_key_tag
|
generate_ds_key_tag
|
||||||
end
|
end
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,11 +74,12 @@ class Domain < ApplicationRecord
|
||||||
before_update :manage_statuses
|
before_update :manage_statuses
|
||||||
def manage_statuses
|
def manage_statuses
|
||||||
return unless will_save_change_to_registrant_id? # rollback has not yet happened
|
return unless will_save_change_to_registrant_id? # rollback has not yet happened
|
||||||
|
|
||||||
pending_update! if registrant_verification_asked?
|
pending_update! if registrant_verification_asked?
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
after_commit :update_whois_record, unless: 'domain_name.at_auction?'
|
after_commit :update_whois_record, unless: -> { domain_name.at_auction? }
|
||||||
|
|
||||||
after_create :update_reserved_domains
|
after_create :update_reserved_domains
|
||||||
def update_reserved_domains
|
def update_reserved_domains
|
||||||
|
|
|
@ -1,96 +0,0 @@
|
||||||
# Built-in since Rails 5.1
|
|
||||||
|
|
||||||
module ActiveSupport
|
|
||||||
module Testing
|
|
||||||
module Assertions
|
|
||||||
UNTRACKED = Object.new # :nodoc:
|
|
||||||
|
|
||||||
# Assertion that the result of evaluating an expression is changed before
|
|
||||||
# and after invoking the passed in block.
|
|
||||||
#
|
|
||||||
# assert_changes 'Status.all_good?' do
|
|
||||||
# post :create, params: { status: { ok: false } }
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# You can pass the block as a string to be evaluated in the context of
|
|
||||||
# the block. A lambda can be passed for the block as well.
|
|
||||||
#
|
|
||||||
# assert_changes -> { Status.all_good? } do
|
|
||||||
# post :create, params: { status: { ok: false } }
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# The assertion is useful to test side effects. The passed block can be
|
|
||||||
# anything that can be converted to string with #to_s.
|
|
||||||
#
|
|
||||||
# assert_changes :@object do
|
|
||||||
# @object = 42
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# The keyword arguments :from and :to can be given to specify the
|
|
||||||
# expected initial value and the expected value after the block was
|
|
||||||
# executed.
|
|
||||||
#
|
|
||||||
# assert_changes :@object, from: nil, to: :foo do
|
|
||||||
# @object = :foo
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# An error message can be specified.
|
|
||||||
#
|
|
||||||
# assert_changes -> { Status.all_good? }, 'Expected the status to be bad' do
|
|
||||||
# post :create, params: { status: { incident: true } }
|
|
||||||
# end
|
|
||||||
def assert_changes(expression, message = nil, from: UNTRACKED, to: UNTRACKED, &block)
|
|
||||||
exp = expression.respond_to?(:call) ? expression : -> { eval(expression.to_s, block.binding) }
|
|
||||||
|
|
||||||
before = exp.call
|
|
||||||
retval = yield
|
|
||||||
|
|
||||||
unless from == UNTRACKED
|
|
||||||
error = "#{expression.inspect} isn't #{from.inspect}"
|
|
||||||
error = "#{message}.\n#{error}" if message
|
|
||||||
assert from === before, error
|
|
||||||
end
|
|
||||||
|
|
||||||
after = exp.call
|
|
||||||
|
|
||||||
if to == UNTRACKED
|
|
||||||
error = "#{expression.inspect} didn't changed"
|
|
||||||
error = "#{message}.\n#{error}" if message
|
|
||||||
assert_not_equal before, after, error
|
|
||||||
else
|
|
||||||
error = "#{expression.inspect} didn't change to #{to}"
|
|
||||||
error = "#{message}.\n#{error}" if message
|
|
||||||
assert to === after, error
|
|
||||||
end
|
|
||||||
|
|
||||||
retval
|
|
||||||
end
|
|
||||||
|
|
||||||
# Assertion that the result of evaluating an expression is changed before
|
|
||||||
# and after invoking the passed in block.
|
|
||||||
#
|
|
||||||
# assert_no_changes 'Status.all_good?' do
|
|
||||||
# post :create, params: { status: { ok: true } }
|
|
||||||
# end
|
|
||||||
#
|
|
||||||
# An error message can be specified.
|
|
||||||
#
|
|
||||||
# assert_no_changes -> { Status.all_good? }, 'Expected the status to be good' do
|
|
||||||
# post :create, params: { status: { ok: false } }
|
|
||||||
# end
|
|
||||||
def assert_no_changes(expression, message = nil, &block)
|
|
||||||
exp = expression.respond_to?(:call) ? expression : -> { eval(expression.to_s, block.binding) }
|
|
||||||
|
|
||||||
before = exp.call
|
|
||||||
retval = yield
|
|
||||||
after = exp.call
|
|
||||||
|
|
||||||
error = "#{expression.inspect} did change to #{after}"
|
|
||||||
error = "#{message}.\n#{error}" if message
|
|
||||||
assert_equal before, after, error
|
|
||||||
|
|
||||||
retval
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end
|
|
|
@ -16,7 +16,6 @@ require 'minitest/mock'
|
||||||
require 'capybara/rails'
|
require 'capybara/rails'
|
||||||
require 'capybara/minitest'
|
require 'capybara/minitest'
|
||||||
require 'webmock/minitest'
|
require 'webmock/minitest'
|
||||||
require 'support/rails5_assertions' # Remove once upgraded to Rails 5.1
|
|
||||||
require 'support/assertions/epp_assertions'
|
require 'support/assertions/epp_assertions'
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue