1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49
|
# frozen_string_literal: true
# rubocop:todo all
module Constraints
# Some tests hardcode the TLS certificates shipped with the driver's
# test suite, and will fail when using TLS connections that use other
# certificates.
def require_local_tls
require_tls
before(:all) do
# TODO This isn't actually the foolproof check
if ENV['OCSP_ALGORITHM']
skip 'Driver TLS certificate required, OCSP certificates are not acceptable'
end
end
end
def minimum_mri_version(version)
require_mri
before(:all) do
if RUBY_VERSION < version
skip "Ruby #{version} or greater is required"
end
end
end
def forbid_x509_auth
before(:all) do
skip 'X.509 auth not allowed' if SpecConfig.instance.x509_auth?
end
end
def max_bson_version(version)
required_version = version.split('.').map(&:to_i)
actual_version = bson_version(required_version.length)
before(:all) do
if (actual_version <=> required_version) > 0
skip "bson-ruby version #{version} or lower is required"
end
end
end
def bson_version(precision)
BSON::VERSION.split('.')[0...precision].map(&:to_i)
end
end
|