Skip to content

Commit f2c2b1f

Browse files
committed
Implement spec test for fail_on_transport
This commit updates the fail_on_transport_spec.rb file to contain a fully implemented test instead of an outline stubbed out with `xif`.
1 parent bfbeed4 commit f2c2b1f

File tree

1 file changed

+22
-4
lines changed

1 file changed

+22
-4
lines changed

spec/functions/fail_on_transport_spec.rb

Lines changed: 22 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,30 @@
33
require 'spec_helper'
44

55
describe 'peadm::fail_on_transport' do
6+
include BoltSpec::BoltContext
7+
8+
around :each do |example|
9+
in_bolt_context do
10+
example.run
11+
end
12+
end
13+
14+
# NOTE: If https://github.com/puppetlabs/bolt/issues/3184
15+
# is fixed, this will start causing a duplicate declaration
16+
# error. If that happens, delete this pre_condition.
17+
let(:pre_condition) do
18+
'type TargetSpec = Boltlib::TargetSpec'
19+
end
20+
621
let(:nodes) do
7-
'some_value_goes_here'
22+
'pcp://target.example'
823
end
9-
let(:transport) do
10-
'some_value_goes_here'
24+
25+
it 'raises an error when nodes use the specified transport' do
26+
expect { subject.execute(nodes, 'pcp') }.to raise_error(Puppet::PreformattedError, /target\.example uses pcp transport/)
1127
end
1228

13-
xit { is_expected.to run.with_params(nodes, transport).and_return('some_value') }
29+
it 'raises no error when nodes do not use the specified transport' do
30+
expect { subject.execute(nodes, 'ssh') }.to_not raise_error
31+
end
1432
end

0 commit comments

Comments
 (0)