X-Git-Url: https://git.adam-barratt.org.uk/?a=blobdiff_plain;f=3rdparty%2Fmodules%2Fstdlib%2Fspec%2Facceptance%2Fpw_hash_spec.rb;h=9c0d716c6385bff2cb8b22950aa32ba3ed94b695;hb=6f656bd4265e3dab13b9af2bf96e9044322e9d8f;hp=829d087776a7d8516435ec04c1c32d58591db62f;hpb=6963202b4b62c2816655ac9532521b018fdf83bd;p=mirror%2Fdsa-puppet.git diff --git a/3rdparty/modules/stdlib/spec/acceptance/pw_hash_spec.rb b/3rdparty/modules/stdlib/spec/acceptance/pw_hash_spec.rb index 829d08777..9c0d716c6 100644 --- a/3rdparty/modules/stdlib/spec/acceptance/pw_hash_spec.rb +++ b/3rdparty/modules/stdlib/spec/acceptance/pw_hash_spec.rb @@ -1,28 +1,25 @@ -#! /usr/bin/env ruby -S rspec require 'spec_helper_acceptance' # Windows and OS X do not have useful implementations of crypt(3) -describe 'pw_hash function', :unless => (['windows', 'Darwin', 'SLES']).include?(fact('operatingsystem')) do +describe 'pw_hash function', :unless => ['windows', 'Darwin', 'SLES'].include?(fact('operatingsystem')) do describe 'success' do - it 'hashes passwords' do - pp = <<-EOS + pp1 = <<-DOC $o = pw_hash('password', 'sha-512', 'salt') notice(inline_template('pw_hash is <%= @o.inspect %>')) - EOS - - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/pw_hash is "\$6\$salt\$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy\.g\."/) + DOC + it 'hashes passwords' do + apply_manifest(pp1, :catch_failures => true) do |r| + expect(r.stdout).to match(%r{pw_hash is "\$6\$salt\$IxDD3jeSOb5eB1CX5LBsqZFVkJdido3OUILO5Ifz5iwMuTS4XMS130MTSuDDl3aCI6WouIL9AjRbLCelDCy\.g\."}) end end - it 'returns nil if no password is provided' do - pp = <<-EOS + pp2 = <<-DOC $o = pw_hash('', 'sha-512', 'salt') notice(inline_template('pw_hash is <%= @o.inspect %>')) - EOS - - apply_manifest(pp, :catch_failures => true) do |r| - expect(r.stdout).to match(/pw_hash is nil/) + DOC + it 'returns nil if no password is provided' do + apply_manifest(pp2, :catch_failures => true) do |r| + expect(r.stdout).to match(%r{pw_hash is nil}) end end end