|
46 | 46 | should contain_file("#{fragdir}/fragments/#{p[:order]}_#{safe_name}").with({ |
47 | 47 | :ensure => safe_ensure, |
48 | 48 | :owner => id, |
49 | | - :group => gid, |
50 | 49 | :mode => '0640', |
51 | 50 | :source => p[:source], |
52 | 51 | :content => p[:content], |
53 | 52 | :alias => "concat_fragment_#{title}", |
54 | 53 | :backup => 'puppet', |
55 | 54 | }) |
| 55 | + # The defined() function doesn't seem to work properly with puppet 3.4 and rspec. |
| 56 | + # defined() works on its own, rspec works on its own, but together they |
| 57 | + # determine that $gid is not defined and cause errors here. Work around |
| 58 | + # it by ignoring this check for older puppet version. |
| 59 | + if Puppet::Util::Package.versioncmp(Puppet.version, '3.5.0') >= 0 |
| 60 | + should contain_file("#{fragdir}/fragments/#{p[:order]}_#{safe_name}").with({ |
| 61 | + :group => gid, |
| 62 | + }) |
| 63 | + end |
56 | 64 | end |
57 | 65 | end |
58 | 66 |
|
|
79 | 87 | let(:params) {{ :target => false }} |
80 | 88 |
|
81 | 89 | it 'should fail' do |
82 | | - expect { should }.to raise_error(Puppet::Error, /is not a string/) |
| 90 | + expect { catalogue }.to raise_error(Puppet::Error, /is not a string/) |
83 | 91 | end |
84 | 92 | end |
85 | 93 | end # target => |
|
121 | 129 | let(:params) {{ :content => false, :target => '/etc/motd' }} |
122 | 130 |
|
123 | 131 | it 'should fail' do |
124 | | - expect { should }.to raise_error(Puppet::Error, /is not a string/) |
| 132 | + expect { catalogue }.to raise_error(Puppet::Error, /is not a string/) |
125 | 133 | end |
126 | 134 | end |
127 | 135 | end # content => |
|
142 | 150 | let(:params) {{ :source => false, :target => '/etc/motd' }} |
143 | 151 |
|
144 | 152 | it 'should fail' do |
145 | | - expect { should }.to raise_error(Puppet::Error, /is not a string or an Array/) |
| 153 | + expect { catalogue }.to raise_error(Puppet::Error, /is not a string or an Array/) |
146 | 154 | end |
147 | 155 | end |
148 | 156 | end # source => |
|
163 | 171 | let(:params) {{ :order => false, :target => '/etc/motd' }} |
164 | 172 |
|
165 | 173 | it 'should fail' do |
166 | | - expect { should }.to raise_error(Puppet::Error, /is not a string or integer/) |
| 174 | + expect { catalogue }.to raise_error(Puppet::Error, /is not a string or integer/) |
167 | 175 | end |
168 | 176 | end |
169 | 177 |
|
|
173 | 181 | let(:params) {{ :order => '123:456', :target => '/etc/motd' }} |
174 | 182 |
|
175 | 183 | it 'should fail' do |
176 | | - expect { should }.to raise_error(Puppet::Error, /cannot contain/) |
| 184 | + expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/) |
177 | 185 | end |
178 | 186 | end |
179 | 187 | context '123/456' do |
|
182 | 190 | let(:params) {{ :order => '123/456', :target => '/etc/motd' }} |
183 | 191 |
|
184 | 192 | it 'should fail' do |
185 | | - expect { should }.to raise_error(Puppet::Error, /cannot contain/) |
| 193 | + expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/) |
186 | 194 | end |
187 | 195 | end |
188 | 196 | context '123\n456' do |
|
191 | 199 | let(:params) {{ :order => "123\n456", :target => '/etc/motd' }} |
192 | 200 |
|
193 | 201 | it 'should fail' do |
194 | | - expect { should }.to raise_error(Puppet::Error, /cannot contain/) |
| 202 | + expect { catalogue }.to raise_error(Puppet::Error, /cannot contain/) |
195 | 203 | end |
196 | 204 | end |
197 | 205 | end # order => |
|
219 | 227 | end |
220 | 228 |
|
221 | 229 | it 'should fail' do |
222 | | - expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m) |
| 230 | + expect { catalogue }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m) |
223 | 231 | end |
224 | 232 | end |
225 | 233 |
|
|
243 | 251 | end |
244 | 252 |
|
245 | 253 | it 'should fail' do |
246 | | - expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m) |
| 254 | + expect { catalogue }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m) |
247 | 255 | end |
248 | 256 | end |
249 | 257 |
|
|
267 | 275 | end |
268 | 276 |
|
269 | 277 | it 'should fail' do |
270 | | - expect { should }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m) |
| 278 | + expect { catalogue }.to raise_error(Puppet::Error, /#{Regexp.escape(error_msg)}/m) |
271 | 279 | end |
272 | 280 | end |
273 | 281 |
|
|
0 commit comments