Projet

Général

Profil

Révision c82b960a

IDc82b960ad4293947acbff27429bad5639d3a4692
Parent 20eaf3c2
Enfant 6c2f0f10

Ajouté par Steve Traylen il y a plus de 3 ans

rubocop:auto_correct results

Voir les différences:

spec/defines/rule_spec.rb
1
# frozen_string_literal: true
2

  
1 3
require 'spec_helper'
2 4

  
3 5
describe 'nftables::rule' do
......
15 17
        context 'with source and content both unset' do
16 18
          it { is_expected.not_to compile }
17 19
        end
20

  
18 21
        context 'with source and content both set' do
19 22
          let(:params) do
20 23
            {
......
25 28

  
26 29
          it {
27 30
            pending('Setting source and content should be made to fail')
28
            is_expected.not_to compile
31
            expect(subject).not_to compile
29 32
          }
30 33
        end
31 34

  
......
36 39

  
37 40
          it { is_expected.to compile.with_all_deps }
38 41
          it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE') }
42

  
39 43
          it {
40
            is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE_header').with(
44
            expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE_header').with(
41 45
              order: '50-nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-a',
42 46
              target: 'nftables-inet-filter-chain-CHAIN_NAME',
43 47
              content: %r{^#.*$}
44 48
            )
45 49
          }
50

  
46 51
          it {
47
            is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE').with(
52
            expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE').with(
48 53
              order: '50-nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-b',
49 54
              target: 'nftables-inet-filter-chain-CHAIN_NAME',
50 55
              content: '  port 22 allow'
51 56
            )
52 57
          }
58

  
53 59
          context 'with optional parameters set' do
54 60
            let(:params) do
55 61
              super().merge(order: '85',
......
57 63
            end
58 64

  
59 65
            it {
60
              is_expected.to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE_header').with(
66
              expect(subject).to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE_header').with(
61 67
                order: '85-nftables-TABLE-chain-CHAIN_NAME-rule-RULE-a',
62 68
                target: 'nftables-TABLE-chain-CHAIN_NAME',
63 69
                content: %r{^#.*$}
64 70
              )
65 71
            }
72

  
66 73
            it { is_expected.to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE') }
74

  
67 75
            it {
68
              is_expected.to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE').with(
76
              expect(subject).to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE').with(
69 77
                order: '85-nftables-TABLE-chain-CHAIN_NAME-rule-RULE-b',
70 78
                target: 'nftables-TABLE-chain-CHAIN_NAME',
71 79
                content: '  port 22 allow'
......
83 91

  
84 92
          it { is_expected.to compile.with_all_deps }
85 93
          it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE') }
94

  
86 95
          it {
87
            is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE_header').with(
96
            expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE_header').with(
88 97
              order: '50-nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-a',
89 98
              target: 'nftables-inet-filter-chain-CHAIN_NAME',
90 99
              content: %r{^#.*$}
91 100
            )
92 101
          }
102

  
93 103
          it {
94
            is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE').with(
104
            expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE').with(
95 105
              order: '50-nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-b',
96 106
              target: 'nftables-inet-filter-chain-CHAIN_NAME',
97 107
              source: 'puppet:///modules/foo/bar'
98 108
            )
99 109
          }
110

  
100 111
          context 'with optional parameters set' do
101 112
            let(:params) do
102 113
              super().merge(order: '85',
......
104 115
            end
105 116

  
106 117
            it {
107
              is_expected.to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE_header').with(
118
              expect(subject).to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE_header').with(
108 119
                order: '85-nftables-TABLE-chain-CHAIN_NAME-rule-RULE-a',
109 120
                target: 'nftables-TABLE-chain-CHAIN_NAME',
110 121
                content: %r{^#.*$}
111 122
              )
112 123
            }
124

  
113 125
            it { is_expected.to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE') }
126

  
114 127
            it {
115
              is_expected.to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE').with(
128
              expect(subject).to contain_concat__fragment('nftables-TABLE-chain-CHAIN_NAME-rule-RULE').with(
116 129
                order: '85-nftables-TABLE-chain-CHAIN_NAME-rule-RULE-b',
117 130
                target: 'nftables-TABLE-chain-CHAIN_NAME',
118 131
                source: 'puppet:///modules/foo/bar'
......
134 147

  
135 148
          it { is_expected.to compile.with_all_deps }
136 149
          it { is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-22') }
150

  
137 151
          it {
138
            is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-22_header').with(
152
            expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-22_header').with(
139 153
              order: '50-nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-22-a',
140 154
              target: 'nftables-inet-filter-chain-CHAIN_NAME',
141 155
              content: %r{^#.*$}
142 156
            )
143 157
          }
158

  
144 159
          it {
145
            is_expected.to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-22').with(
160
            expect(subject).to contain_concat__fragment('nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-22').with(
146 161
              order: '50-nftables-inet-filter-chain-CHAIN_NAME-rule-RULE-22-b',
147 162
              target: 'nftables-inet-filter-chain-CHAIN_NAME',
148 163
              content: '  port 22 allow'

Formats disponibles : Unified diff