Skip to content

Commit 7295423

Browse files
author
Helen Campbell
committed
Update deprecation tests to include future parser
1 parent 746c1f8 commit 7295423

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

spec/functions/deprecation_spec.rb

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,11 +41,14 @@
4141
}
4242
end
4343
else
44+
# Puppet version < 4 will use these tests.
4445
describe 'deprecation' do
4546
after(:all) do
4647
ENV.delete('STDLIB_LOG_DEPRECATIONS')
4748
end
48-
ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
49+
before(:all) do
50+
ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
51+
end
4952
it { is_expected.not_to eq(nil) }
5053
it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
5154

@@ -54,4 +57,21 @@
5457
is_expected.to run.with_params('key', 'heelo')
5558
end
5659
end
60+
# Tests the Puppet 3 setup with future parser enabled.
61+
if ENV['FUTURE_PARSER'] = "true"
62+
describe 'deprecation' do
63+
after(:all) do
64+
ENV.delete('STDLIB_LOG_DEPRECATIONS')
65+
end
66+
before(:all) do
67+
ENV['STDLIB_LOG_DEPRECATIONS'] = "true"
68+
end
69+
it { is_expected.not_to eq(nil) }
70+
it { is_expected.to run.with_params().and_raise_error(Puppet::ParseError, /wrong number of arguments/i) }
71+
it 'should display a single warning' do
72+
scope.expects(:warning).with(includes('heelo'))
73+
is_expected.to run.with_params('key', 'heelo')
74+
end
75+
end
76+
end
5777
end

0 commit comments

Comments
 (0)