File: custom_insync_spec_hidden_property.rb

package info (click to toggle)
ruby-puppet-resource-api 1.9.0-1
  • links: PTS, VCS
  • area: main
  • in suites: trixie
  • size: 1,232 kB
  • sloc: ruby: 9,573; sh: 4; makefile: 2
file content (33 lines) | stat: -rw-r--r-- 1,226 bytes parent folder | download | duplicates (2)
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
# frozen_string_literal: true

require 'spec_helper'
require 'tempfile'

RSpec.describe 'a provider using custom insync' do
  subject(:stdout_str) do
    stdout_str, _status = Open3.capture2e("puppet apply --verbose --trace --strict=error --modulepath spec/fixtures -e \"#{manifest}\"")
    stdout_str
  end

  describe 'using `puppet apply`' do
    context 'when force is not specified' do
      let(:manifest) { 'test_custom_insync_hidden_property { example: }' }

      it 'calls insync? against rsapi_custom_insync_trigger, reporting no changes' do
        expect(stdout_str).not_to match %r{Setting with}
        expect(stdout_str).not_to match %r{Error:}
      end
    end

    context 'when force is specified as true' do
      let(:manifest) { 'test_custom_insync_hidden_property { example: force => true }' }

      it 'calls insync? against rsapi_custom_insync_trigger, reporting a change' do
        expect(stdout_str).to match %r{Out of sync!}
        expect(stdout_str).to match %r{Custom insync logic determined that this resource is out of sync}
        expect(stdout_str).to match %r{Setting with {:name=>"example", :force=>true}}
        expect(stdout_str).not_to match %r{Error:}
      end
    end
  end
end