From da4743406aa40924997031b7c9736de021a5a09e Mon Sep 17 00:00:00 2001 From: Tim Meusel Date: Fri, 13 Sep 2024 20:51:48 +0200 Subject: [PATCH] test --- REFERENCE.md | 2 +- manifests/init.pp | 2 +- spec/classes/example_spec.rb | 10 +++++++++- 3 files changed, 11 insertions(+), 3 deletions(-) diff --git a/REFERENCE.md b/REFERENCE.md index 4808be2..51eb615 100644 --- a/REFERENCE.md +++ b/REFERENCE.md @@ -35,5 +35,5 @@ Data type: `String[1]` The content in the file -Default value: `'Hello World!'` +Default value: `$facts['networking']['fqdn']` diff --git a/manifests/init.pp b/manifests/init.pp index fbf7850..23a4cc4 100644 --- a/manifests/init.pp +++ b/manifests/init.pp @@ -5,7 +5,7 @@ # The content in the file class example ( Stdlib::Absolutepath $file = '/tmp/puppet-example', - String[1] $content = 'Hello World!', + String[1] $content = $facts['networking']['fqdn'], ) { file { $file: ensure => file, diff --git a/spec/classes/example_spec.rb b/spec/classes/example_spec.rb index e19972e..433cb34 100644 --- a/spec/classes/example_spec.rb +++ b/spec/classes/example_spec.rb @@ -8,7 +8,15 @@ let(:facts) { os_facts } it { is_expected.to compile.with_all_deps } - it { is_expected.to contain_file('/tmp/puppet-example').with_content('Hello World!') } + #it { is_expected.to contain_file('/tmp/puppet-example').with_content('Hello World!') } + end + context 'with data' do + + let :node do + 'test.awesome.com' + end + + it { is_expected.to contain_file('/tmp/puppet-example').with_content('test.awesome.com')} end end end