Révision c82b960a
rubocop:auto_correct results
spec/defines/config_spec.rb | ||
---|---|---|
1 |
# frozen_string_literal: true |
|
2 |
|
|
1 | 3 |
require 'spec_helper' |
2 | 4 |
|
3 | 5 |
describe 'nftables::config' do |
... | ... | |
13 | 15 |
context 'with source and content both unset' do |
14 | 16 |
it { is_expected.to compile } |
15 | 17 |
it { is_expected.to contain_concat('nftables-FOO-BAR') } |
18 |
|
|
16 | 19 |
it { |
17 |
is_expected.to contain_concat('nftables-FOO-BAR').with(
|
|
20 |
expect(subject).to contain_concat('nftables-FOO-BAR').with(
|
|
18 | 21 |
path: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft', |
19 | 22 |
ensure_newline: true, |
20 | 23 |
mode: '0640' |
21 | 24 |
) |
22 | 25 |
} |
26 |
|
|
23 | 27 |
it { is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft') } |
28 |
|
|
24 | 29 |
it { |
25 |
is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft').with(
|
|
30 |
expect(subject).to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft').with(
|
|
26 | 31 |
ensure: 'file', |
27 | 32 |
source: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft', |
28 | 33 |
mode: '0640' |
29 | 34 |
) |
30 | 35 |
} |
36 |
|
|
31 | 37 |
it { is_expected.to contain_concat_fragment('nftables-FOO-BAR-header') } |
38 |
|
|
32 | 39 |
it { |
33 |
is_expected.to contain_concat_fragment('nftables-FOO-BAR-header').with(
|
|
40 |
expect(subject).to contain_concat_fragment('nftables-FOO-BAR-header').with(
|
|
34 | 41 |
target: 'nftables-FOO-BAR', |
35 | 42 |
order: '00', |
36 | 43 |
content: 'table FOO BAR {' |
37 | 44 |
) |
38 | 45 |
} |
46 |
|
|
39 | 47 |
it { |
40 |
is_expected.to contain_concat_fragment('nftables-FOO-BAR-body').with(
|
|
48 |
expect(subject).to contain_concat_fragment('nftables-FOO-BAR-body').with(
|
|
41 | 49 |
target: 'nftables-FOO-BAR', |
42 | 50 |
order: '98', |
43 | 51 |
content: ' include "FOO-BAR-chain-*.nft"' |
... | ... | |
60 | 68 |
end |
61 | 69 |
|
62 | 70 |
it { |
63 |
is_expected.not_to compile
|
|
71 |
expect(subject).not_to compile
|
|
64 | 72 |
} |
65 | 73 |
end |
74 |
|
|
66 | 75 |
context 'with content set' do |
67 | 76 |
let(:params) do |
68 | 77 |
{ |
... | ... | |
72 | 81 |
|
73 | 82 |
it { is_expected.to compile } |
74 | 83 |
it { is_expected.to contain_concat('nftables-FOO-BAR') } |
84 |
|
|
75 | 85 |
it { |
76 |
is_expected.to contain_concat('nftables-FOO-BAR').with(
|
|
86 |
expect(subject).to contain_concat('nftables-FOO-BAR').with(
|
|
77 | 87 |
path: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft', |
78 | 88 |
ensure_newline: true, |
79 | 89 |
mode: '0640' |
80 | 90 |
) |
81 | 91 |
} |
92 |
|
|
82 | 93 |
it { is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft') } |
94 |
|
|
83 | 95 |
it { |
84 |
is_expected.to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft').with(
|
|
96 |
expect(subject).to contain_file('/etc/nftables/puppet/custom-FOO-BAR.nft').with(
|
|
85 | 97 |
ensure: 'file', |
86 | 98 |
source: '/etc/nftables/puppet-preflight/custom-FOO-BAR.nft', |
87 | 99 |
mode: '0640' |
88 | 100 |
) |
89 | 101 |
} |
102 |
|
|
90 | 103 |
it { is_expected.to contain_concat_fragment('nftables-FOO-BAR-header') } |
104 |
|
|
91 | 105 |
it { |
92 |
is_expected.to contain_concat_fragment('nftables-FOO-BAR-header').with(
|
|
106 |
expect(subject).to contain_concat_fragment('nftables-FOO-BAR-header').with(
|
|
93 | 107 |
target: 'nftables-FOO-BAR', |
94 | 108 |
order: '00', |
95 | 109 |
content: 'table FOO BAR {' |
96 | 110 |
) |
97 | 111 |
} |
112 |
|
|
98 | 113 |
it { |
99 |
is_expected.to contain_concat_fragment('nftables-FOO-BAR-body').with(
|
|
114 |
expect(subject).to contain_concat_fragment('nftables-FOO-BAR-body').with(
|
|
100 | 115 |
target: 'nftables-FOO-BAR', |
101 | 116 |
order: '98', |
102 | 117 |
content: 'strange content' |
103 | 118 |
) |
104 | 119 |
} |
105 | 120 |
end |
121 |
|
|
106 | 122 |
context 'with source set' do |
107 | 123 |
let(:params) do |
108 | 124 |
{ |
... | ... | |
111 | 127 |
end |
112 | 128 |
|
113 | 129 |
it { |
114 |
is_expected.to contain_concat_fragment('nftables-FOO-BAR-body').with(
|
|
130 |
expect(subject).to contain_concat_fragment('nftables-FOO-BAR-body').with(
|
|
115 | 131 |
target: 'nftables-FOO-BAR', |
116 | 132 |
order: '98', |
117 | 133 |
source: 'puppet:///modules/foo' |
Formats disponibles : Unified diff