|
5 | 5 | describe 'cpan' do
|
6 | 6 | let(:title) { 'baz' }
|
7 | 7 |
|
8 |
| - describe 'valid type' do |
9 |
| - it { is_expected.to be_valid_type } |
10 |
| - end |
11 |
| - describe 'ensure' do |
12 |
| - [:present, :absent, :installed, :latest].each do |value| |
13 |
| - it "accepts #{value} as a value" do |
14 |
| - is_expected.to be_valid_type.with_set_attributes(ensure: value) |
15 |
| - end |
16 |
| - end |
17 |
| - it 'rejects other values' do |
18 |
| - expect { described_type.new(name: 'test', ensure: 'foo') }.to raise_error(Puppet::Error) |
19 |
| - end |
20 |
| - end |
21 |
| - |
22 |
| - describe 'name' do |
23 |
| - it 'is the namevar' do |
24 |
| - expect(described_type.key_attributes).to eq([:name]) |
25 |
| - end |
26 |
| - end |
27 |
| - |
28 |
| - describe 'local_lib' do |
29 |
| - it 'accepts an absolute path' do |
30 |
| - is_expected.to be_valid_type.with_set_attributes(local_lib: '/path/to/file') |
31 |
| - end |
32 |
| - it 'accepts false' do |
33 |
| - is_expected.to be_valid_type.with_set_attributes(local_lib: false) |
34 |
| - end |
35 |
| - end |
36 |
| - |
37 | 8 | describe 'force' do
|
38 |
| - [true, false, 'true', 'false', 'no', 'yes'].each do |value| |
39 |
| - it "accepts #{value}" do |
40 |
| - is_expected.to be_valid_type.with_set_attributes(force: value) |
41 |
| - end |
42 |
| - end |
43 |
| - it 'rejects other values' do |
44 |
| - # for some reason expect { be_valid_type.with_set_attributes({:force => 'nope'})}.to raise_error doesn't raise |
45 |
| - # expect {be_valid_type.with_set_attributes({:force => 'nope'})}.to raise_error(Puppet::ResourceError) |
| 9 | + it 'rejects other values (rspec)' do |
46 | 10 | expect { described_type.new(name: 'test', force: 'nope') }.to raise_error(Puppet::Error)
|
47 | 11 | end
|
48 |
| - it 'defaults to false' do |
49 |
| - expect(described_type.new(name: 'test')[:force]).to eq(false) |
50 |
| - end |
51 |
| - it 'munges \'false\' to false' do |
52 |
| - expect(described_type.new(name: 'test', force: 'false')[:force]).to eq(false) |
53 |
| - end |
54 |
| - it 'munges \'true\' to true' do |
55 |
| - expect(described_type.new(name: 'test', force: 'true')[:force]).to eq(true) |
56 |
| - end |
57 |
| - end |
58 |
| - |
59 |
| - describe 'umask' do |
60 |
| - describe 'valid values' do |
61 |
| - ['0022', '022', '0027', '027'].each do |value| |
62 |
| - it "accepts #{value}" do |
63 |
| - is_expected.to be_valid_type.with_set_attributes(umask: value) |
64 |
| - end |
65 |
| - end |
66 |
| - end |
67 |
| - describe 'invalid values' do |
68 |
| - [true, false, 220, '0', '888', 'invalid'].each do |value| |
69 |
| - it "rejects #{value}" do |
70 |
| - expect { described_type.new(name: 'test', umask: value) }.to raise_error(Puppet::Error) |
71 |
| - end |
72 |
| - end |
| 12 | + it 'rejects other values (be_valid_type)' do |
| 13 | + expect { be_valid_type.with_set_attributes(force: 'nope') }.to raise_error(Puppet::Error) |
73 | 14 | end
|
74 | 15 | end
|
75 | 16 | end
|
0 commit comments