Skip to content

Commit 51c9d28

Browse files
committed
use versioncmp rather than writing it out as plain code
1 parent 3fc0f68 commit 51c9d28

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

spec/functions/pw_hash_spec.rb

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -66,8 +66,7 @@
6666

6767
begin
6868
require 'etc'
69-
if Etc.confstr(Etc::CS_GNU_LIBC_VERSION) =~ %r{(\d+)\.(\d+)} &&
70-
(Regexp.last_match(1).to_i > 2 || (Regexp.last_match(1).to_i == 2 && Regexp.last_match(2).to_i >= 28))
69+
if Etc.confstr(Etc::CS_GNU_LIBC_VERSION) =~ %r{(\d+\.\d+)} && Puppet::Util::Package.versioncmp(Regexp.last_match(1), '2.28') >= 0
7170
context 'when running on platform with bcrypt' do
7271
it { is_expected.to run.with_params('password', 'bcrypt', '05$salt.salt.salt.salt.sa').and_return('$2b$05$salt.salt.salt.salt.sO5QUgeeLRANZyvfNiKJW5amLo3cVD8nW') }
7372
it { is_expected.to run.with_params('password', 'bcrypt-a', '05$salt.salt.salt.salt.sa').and_return('$2a$05$salt.salt.salt.salt.sO5QUgeeLRANZyvfNiKJW5amLo3cVD8nW') }

0 commit comments

Comments
 (0)