Skip to content

Commit

Permalink
Better reasons to skip tests
Browse files Browse the repository at this point in the history
  • Loading branch information
anakinj committed Oct 29, 2022
1 parent d9d96d1 commit cdb24c8
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
6 changes: 5 additions & 1 deletion lib/jwt/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,10 @@ def self.openssl_3?
end

def self.openssl_3_hmac_empty_key_regression?
openssl_3? && ::Gem::Version.new(OpenSSL::VERSION) <= ::Gem::Version.new('3.0.0')
openssl_3? && openssl_version <= ::Gem::Version.new('3.0.0')
end

def self.openssl_version
@openssl_version ||= ::Gem::Version.new(OpenSSL::VERSION)
end
end
8 changes: 6 additions & 2 deletions spec/jwk/rsa_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,10 @@
context 'when e, n, d is given' do
let(:jwk_parameters) { all_jwk_parameters.slice(:e, :n, :d) }

before do
skip 'OpenSSL prior to 2.2 does not seem to support partial parameters' if ::JWT.openssl_version < ::Gem::Version.new('2.2')
end

it 'creates a valid RSA object representing a private key' do
expect(subject).to be_a(::OpenSSL::PKey::RSA)
expect(subject.private?).to eq(true)
Expand All @@ -196,8 +200,8 @@

describe '.create_rsa_key_using_sets' do
before do
skip unless OpenSSL::PKey::RSA.new.respond_to?(:set_key)
skip if ::JWT.openssl_3?
skip 'OpenSSL without the RSA#set_key method not supported' unless OpenSSL::PKey::RSA.new.respond_to?(:set_key)
skip 'OpenSSL 3.0 does not allow mutating objects anymore' if ::JWT.openssl_3?
end

subject(:rsa) { described_class.create_rsa_key_using_sets(rsa_parameters) }
Expand Down

0 comments on commit cdb24c8

Please sign in to comment.