File tree 1 file changed +27
-4
lines changed
1 file changed +27
-4
lines changed Original file line number Diff line number Diff line change 3
3
require 'spec_helper'
4
4
5
5
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
+
6
21
let ( :nodes ) do
7
- 'some_value_goes_here '
22
+ 'pcp://target.example '
8
23
end
9
- let ( :transport ) do
10
- 'some_value_goes_here'
24
+
25
+ # Function testing depends on rspec-puppet magic in the opening describe
26
+ # statement. Re-defining the subject just to give it a different name
27
+ # would require duplicating rspec-puppet code, and that's a far worse sin.
28
+ # rubocop:disable Rspec/NamedSubject
29
+ it 'raises an error when nodes use the specified transport' do
30
+ expect { subject . execute ( nodes , 'pcp' ) } . to raise_error ( Puppet ::PreformattedError , %r{target\. example uses pcp transport} )
11
31
end
12
32
13
- xit { is_expected . to run . with_params ( nodes , transport ) . and_return ( 'some_value' ) }
33
+ it 'raises no error when nodes do not use the specified transport' do
34
+ expect { subject . execute ( nodes , 'ssh' ) } . not_to raise_error
35
+ end
36
+ # rubocop:enable Rspec/NamedSubject
14
37
end
You can’t perform that action at this time.
0 commit comments