Skip to content

Commit

Permalink
Drop RSpec 2 support
Browse files Browse the repository at this point in the history
  • Loading branch information
ekohl authored and jordanbreen28 committed Oct 2, 2023
1 parent 9cd4565 commit 1dbc0d6
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 15 deletions.
2 changes: 1 addition & 1 deletion lib/rspec-puppet/spec_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
require 'rspec-puppet'

RSpec.configure do |c|
c.module_path = File.join(__dir__, 'fixtures', 'modules')
c.module_path = File.join(__dir__, 'fixtures', 'modules')
c.manifest = File.join(fixture_path, 'manifests', 'site.pp')
c.environmentpath = __dir__
end
13 changes: 6 additions & 7 deletions spec/classes/server_facts_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,10 @@
end
let(:node) { 'test123.test.com' }

it { is_expected.to contain_class('server_facts') }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_notify('servername-test123.test.com') }
it { is_expected.to contain_notify('serverip-192.168.1.10') }
it { is_expected.to contain_notify("serverversion-#{Puppet.version}") }
it { is_expected.to contain_notify('environment-rp_env') }
end
it { is_expected.to contain_class('server_facts') }
it { is_expected.to compile.with_all_deps }
it { is_expected.to contain_notify('servername-test123.test.com') }
it { is_expected.to contain_notify('serverip-192.168.1.10') }
it { is_expected.to contain_notify("serverversion-#{Puppet.version}") }
it { is_expected.to contain_notify('environment-rp_env') }
end
14 changes: 8 additions & 6 deletions spec/unit/adapters_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,19 +32,21 @@ def context_double(options = {})
end

it 'sets Puppet[:strict_variables] to false by default' do
subject.setup_puppet(test_context)
expect(Puppet[:strict_variables]).to be(false)
subject.setup_puppet(context_double)
# strict variables enabled by default in puppet 8.x +
setting = Puppet::Util::Package.versioncmp(Puppet.version, '8.0.0') >= 0
expect(Puppet[:strict_variables]).to be(setting)
end

it 'reads the :strict_variables setting' do
allow(test_context).to receive(:strict_variables).and_return(true)
subject.setup_puppet(test_context)
context = context_double strict_variables: true
subject.setup_puppet(context)
expect(Puppet[:strict_variables]).to be(true)
end

it 'overrides the environmentpath set by Puppet::Test::TestHelper' do
allow(test_context).to receive(:environmentpath).and_return('/path/to/my/environments')
subject.setup_puppet(test_context)
context = context_double environmentpath: '/path/to/my/environments'
subject.setup_puppet(context)
expect(Puppet[:environmentpath]).to match(%r{(C:)?/path/to/my/environments})
end

Expand Down
2 changes: 1 addition & 1 deletion spec/unit/matchers/compile_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@

context 'when expecting the failure' do
let(:expected_error) do
"Evaluation Error: Error while evaluating a Function Call, 'failure (line: 52, column: 1)' on node rspec::puppet::manifestmatchers::compile"
'Evaluation Error: Error while evaluating a Function Call, failure (line: 52, column: 1) on node rspec::puppet::manifestmatchers::compile'
end

before { subject.and_raise_error(expected_error) }
Expand Down

0 comments on commit 1dbc0d6

Please sign in to comment.