|
127 | 127 | # As it turns out cron does not complaining about steps that exceed the valid range |
128 | 128 | # expect { described_class.new(:name => 'foo', :minute => '*/120' ) }.to raise_error(Puppet::Error, /is not a valid minute/) |
129 | 129 | end |
| 130 | + |
| 131 | + it 'supports values with leading zeros' do |
| 132 | + expect { described_class.new(name: 'foo', minute: ['0', '0011', '044']) }.not_to raise_error |
| 133 | + expect { described_class.new(name: 'foo', minute: '022') }.not_to raise_error |
| 134 | + end |
| 135 | + |
| 136 | + it 'does not remove leading zeroes' do |
| 137 | + expect(described_class.new(name: 'foo', minute: '0045')[:minute]).to eq(['0045']) |
| 138 | + end |
130 | 139 | end |
131 | 140 |
|
132 | 141 | describe 'hour' do |
|
194 | 203 | # As it turns out cron does not complaining about steps that exceed the valid range |
195 | 204 | # expect { described_class.new(:name => 'foo', :hour => '*/26' ) }.to raise_error(Puppet::Error, /is not a valid hour/) |
196 | 205 | end |
| 206 | + |
| 207 | + it 'supports values with leading zeros' do |
| 208 | + expect { described_class.new(name: 'foo', hour: ['007', '1', '0023']) }.not_to raise_error |
| 209 | + expect { described_class.new(name: 'foo', hour: '022') }.not_to raise_error |
| 210 | + end |
| 211 | + |
| 212 | + it 'does not remove leading zeroes' do |
| 213 | + expect(described_class.new(name: 'foo', hour: '005')[:hour]).to eq(['005']) |
| 214 | + end |
197 | 215 | end |
198 | 216 |
|
199 | 217 | describe 'weekday' do |
|
277 | 295 | # As it turns out cron does not complaining about steps that exceed the valid range |
278 | 296 | # expect { described_class.new(:name => 'foo', :weekday => '*/9' ) }.to raise_error(Puppet::Error, /is not a valid weekday/) |
279 | 297 | end |
| 298 | + |
| 299 | + it 'supports values with leading zeros' do |
| 300 | + expect { described_class.new(name: 'foo', weekday: ['Mon', 'Wed', '05']) }.not_to raise_error |
| 301 | + expect { described_class.new(name: 'foo', weekday: '007') }.not_to raise_error |
| 302 | + end |
| 303 | + |
| 304 | + it 'does not remove leading zeroes' do |
| 305 | + expect(described_class.new(name: 'foo', weekday: '006')[:weekday]).to eq(['006']) |
| 306 | + end |
280 | 307 | end |
281 | 308 |
|
282 | 309 | describe 'month' do |
|
376 | 403 | # As it turns out cron does not complaining about steps that exceed the valid range |
377 | 404 | # expect { described_class.new(:name => 'foo', :month => '*/13' ) }.to raise_error(Puppet::Error, /is not a valid month/) |
378 | 405 | end |
| 406 | + |
| 407 | + it 'supports values with leading zeros' do |
| 408 | + expect { described_class.new(name: 'foo', month: ['007', '1', '0012']) }.not_to raise_error |
| 409 | + expect { described_class.new(name: 'foo', month: ['Jan', '04', '0009']) }.not_to raise_error |
| 410 | + end |
| 411 | + |
| 412 | + it 'does not remove leading zeroes' do |
| 413 | + expect(described_class.new(name: 'foo', month: '09')[:month]).to eq(['09']) |
| 414 | + end |
379 | 415 | end |
380 | 416 |
|
381 | 417 | describe 'monthday' do |
|
441 | 477 | # As it turns out cron does not complaining about steps that exceed the valid range |
442 | 478 | # expect { described_class.new(:name => 'foo', :monthday => '*/32' ) }.to raise_error(Puppet::Error, /is not a valid monthday/) |
443 | 479 | end |
| 480 | + |
| 481 | + it 'supports values with leading zeros' do |
| 482 | + expect { described_class.new(name: 'foo', monthday: ['007', '1', '0023']) }.not_to raise_error |
| 483 | + expect { described_class.new(name: 'foo', monthday: '022') }.not_to raise_error |
| 484 | + end |
| 485 | + |
| 486 | + it 'does not remove leading zeroes' do |
| 487 | + expect(described_class.new(name: 'foo', monthday: '01')[:monthday]).to eq(['01']) |
| 488 | + end |
444 | 489 | end |
445 | 490 |
|
446 | 491 | describe 'special' do |
|
0 commit comments