Sha256: 4f4e1c668efe96fe8f8e5db30fce846392538cc69ba1a08b50d396b3a6060f50

Contents?: true

Size: 831 Bytes

Versions: 424

Compression:

Stored size: 831 Bytes

Contents

require 'spec_helper'

require 'puppet_spec/compiler'
require 'matchers/resource'

describe 'the unwrap function' do
  include PuppetSpec::Compiler
  include Matchers::Resource

  it 'unwraps a sensitive value' do
    code = <<-CODE
      $sensitive = Sensitive.new("12345")
      notice("unwrapped value is ${sensitive.unwrap}")
    CODE
    expect(eval_and_collect_notices(code)).to eq(['unwrapped value is 12345'])
  end

  it 'unwraps a sensitive value when given a code block' do
    code = <<-CODE
      $sensitive = Sensitive.new("12345")
      $split = $sensitive.unwrap |$unwrapped| {
        notice("unwrapped value is $unwrapped")
        $unwrapped.split(/3/)
      }
      notice("split is $split")
    CODE
    expect(eval_and_collect_notices(code)).to eq(['unwrapped value is 12345', 'split is [12, 45]'])
  end
end

Version data entries

424 entries across 424 versions & 1 rubygems

Version Path
puppet-6.23.0 spec/unit/functions/unwrap_spec.rb
puppet-6.23.0-x86-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-6.23.0-x64-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-6.23.0-universal-darwin spec/unit/functions/unwrap_spec.rb
puppet-7.8.0 spec/unit/functions/unwrap_spec.rb
puppet-7.8.0-x86-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-7.8.0-x64-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-7.8.0-universal-darwin spec/unit/functions/unwrap_spec.rb
puppet-7.7.0 spec/unit/functions/unwrap_spec.rb
puppet-7.7.0-x86-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-7.7.0-x64-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-7.7.0-universal-darwin spec/unit/functions/unwrap_spec.rb
puppet-6.22.1 spec/unit/functions/unwrap_spec.rb
puppet-6.22.1-x86-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-6.22.1-x64-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-6.22.1-universal-darwin spec/unit/functions/unwrap_spec.rb
puppet-7.6.1 spec/unit/functions/unwrap_spec.rb
puppet-7.6.1-x86-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-7.6.1-x64-mingw32 spec/unit/functions/unwrap_spec.rb
puppet-7.6.1-universal-darwin spec/unit/functions/unwrap_spec.rb