File: sensitive_spec.rb

package info (click to toggle)
ruby-rspec-puppet 4.0.2%2Bds-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,444 kB
  • sloc: ruby: 6,377; makefile: 6
file content (38 lines) | stat: -rw-r--r-- 890 bytes parent folder | download
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
# frozen_string_literal: true

require 'spec_helper'
require 'rspec-puppet/sensitive'

describe RSpec::Puppet::Sensitive do
  subject(:sensitive) { described_class.new contents }

  let(:contents) { double :contents }

  describe '#sensitive?' do
    it 'returns true' do
      expect(sensitive).to be_sensitive
    end
  end

  describe '#unwrap' do
    it 'returns the wrapped value' do
      expect(sensitive.unwrap).to eq contents
    end
  end

  describe '#inspect' do
    it 'wraps the contents in Sensitive()' do
      expect(sensitive.inspect).to eq "Sensitive(#{contents.inspect})"
    end
  end

  describe '#==' do
    it 'compares equal to Puppet sensitive type' do
      expect(sensitive).to eq Puppet::Pops::Types::PSensitiveType::Sensitive.new contents
    end

    it 'compares false to the unwrapped value' do
      expect(sensitive).not_to eq(contents)
    end
  end
end