Skip to content

Commit 0a353c8

Browse files
committed
(maint) - Update tests
1 parent 0b92ee4 commit 0a353c8

File tree

3 files changed

+25
-8
lines changed

3 files changed

+25
-8
lines changed

lib/rspec-puppet/spec_helper.rb

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
RSpec.configure do |c|
66
c.module_path = File.join(fixture_path, 'modules')
7-
c.manifest_dir = File.join(fixture_path, 'manifests')
87
c.manifest = File.join(fixture_path, 'manifests', 'site.pp')
98
c.environmentpath = File.join(Dir.pwd, 'spec')
109
end

spec/classes/server_facts_spec.rb

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,10 @@
1010
end
1111
let(:node) { 'test123.test.com' }
1212

13-
it { is_expected.to contain_class('server_facts') }
14-
it { is_expected.to compile.with_all_deps }
15-
it { is_expected.to contain_notify('servername-test123.test.com') }
16-
it { is_expected.to contain_notify('serverip-192.168.1.10') }
17-
it { is_expected.to contain_notify("serverversion-#{Puppet.version}") }
18-
it { is_expected.to contain_notify('environment-rp_env') }
19-
end
13+
it { is_expected.to contain_class('server_facts') }
14+
it { is_expected.to compile.with_all_deps }
15+
it { is_expected.to contain_notify('servername-test123.test.com') }
16+
it { is_expected.to contain_notify('serverip-192.168.1.10') }
17+
it { is_expected.to contain_notify("serverversion-#{Puppet.version}") }
18+
it { is_expected.to contain_notify('environment-rp_env') }
2019
end

spec/unit/adapters_spec.rb

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,25 @@ def context_double(options = {})
3131
end
3232
end
3333

34+
it 'sets Puppet[:strict_variables] to false by default' do
35+
subject.setup_puppet(context_double)
36+
# strict variables enabled by default in puppet 8.x +
37+
setting = Puppet::Util::Package.versioncmp(Puppet.version, '8.0.0') >= 0
38+
expect(Puppet[:strict_variables]).to be(setting)
39+
end
40+
41+
it 'reads the :strict_variables setting' do
42+
context = context_double strict_variables: true
43+
subject.setup_puppet(context)
44+
expect(Puppet[:strict_variables]).to be(true)
45+
end
46+
47+
it 'overrides the environmentpath set by Puppet::Test::TestHelper' do
48+
context = context_double environmentpath: '/path/to/my/environments'
49+
subject.setup_puppet(context)
50+
expect(Puppet[:environmentpath]).to match(%r{(C:)?/path/to/my/environments})
51+
end
52+
3453
describe '#set_setting' do
3554
describe 'with a context specific setting' do
3655
it 'sets the Puppet setting based on the example group setting' do

0 commit comments

Comments
 (0)