Pump minitest version

This commit is contained in:
Alex Sherman 2020-01-30 13:55:08 +05:00
parent c7593338e2
commit 4e1bec3613
7 changed files with 12 additions and 105 deletions

View file

@ -84,8 +84,8 @@ end
group :test do
gem 'capybara'
gem 'database_cleaner'
gem 'minitest', '~> 5.14'
gem 'simplecov', require: false
gem 'webdrivers'
gem 'webmock'
gem 'minitest', '~> 5.10.0'
end

View file

@ -250,7 +250,7 @@ GEM
rake
mini_mime (1.0.2)
mini_portile2 (2.4.0)
minitest (5.10.3)
minitest (5.14.0)
monetize (1.9.4)
money (~> 6.12)
money (6.13.7)
@ -479,7 +479,7 @@ DEPENDENCIES
kaminari
lhv!
mina (= 0.3.1)
minitest (~> 5.10.0)
minitest (~> 5.14)
money-rails
nokogiri
paper_trail (~> 4.0)

View file

@ -23,7 +23,9 @@ class Contact < ApplicationRecord
accepts_nested_attributes_for :legal_documents
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

View file

@ -9,15 +9,16 @@ class Dnskey < ApplicationRecord
validate :validate_protocol
validate :validate_flags
before_save -> { generate_digest if will_save_change_to_public_key? &&
!will_save_change_to_ds_digest? }
before_save lambda {
generate_digest if will_save_change_to_public_key? && !will_save_change_to_ds_digest?
}
before_save lambda {
if (will_save_change_to_public_key? ||
will_save_change_to_flags? ||
will_save_change_to_alg? ||
will_save_change_to_protocol?) &&
!will_save_change_to_ds_key_tag?
!will_save_change_to_ds_key_tag?
generate_ds_key_tag
end
}

View file

@ -74,11 +74,12 @@ class Domain < ApplicationRecord
before_update :manage_statuses
def manage_statuses
return unless will_save_change_to_registrant_id? # rollback has not yet happened
pending_update! if registrant_verification_asked?
true
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
def update_reserved_domains

View file

@ -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

View file

@ -16,7 +16,6 @@ require 'minitest/mock'
require 'capybara/rails'
require 'capybara/minitest'
require 'webmock/minitest'
require 'support/rails5_assertions' # Remove once upgraded to Rails 5.1
require 'support/assertions/epp_assertions'