|
2 | 2 |
|
3 | 3 | describe 'python::requirements', type: :define do
|
4 | 4 | on_supported_os.each do |os, facts|
|
5 |
| - context "on #{os} " do |
| 5 | + context "on #{os}" do |
6 | 6 | let :facts do
|
7 | 7 | facts
|
8 | 8 | end
|
|
11 | 11 | '/requirements.txt'
|
12 | 12 | end
|
13 | 13 |
|
14 |
| - context 'on Debian OS' do |
15 |
| - describe 'requirements as' do |
16 |
| - context '/requirements.txt' do |
17 |
| - let :params do |
18 |
| - { |
19 |
| - requirements: '/requirements.txt' |
20 |
| - } |
21 |
| - end |
| 14 | + context 'with /requirements.txt' do |
| 15 | + let :params do |
| 16 | + { |
| 17 | + requirements: '/requirements.txt' |
| 18 | + } |
| 19 | + end |
22 | 20 |
|
23 |
| - it { is_expected.to contain_file('/requirements.txt').with_mode('0644') } |
24 |
| - end |
25 |
| - context '/requirements.txt' do |
26 |
| - let :params do |
27 |
| - { |
28 |
| - requirements: '/requirements.txt', |
29 |
| - manage_requirements: false |
30 |
| - } |
31 |
| - end |
32 |
| - |
33 |
| - it { is_expected.not_to contain_file('/requirements.txt') } |
34 |
| - end |
| 21 | + it { is_expected.to contain_file('/requirements.txt').with_mode('0644') } |
35 | 22 |
|
36 |
| - describe 'with owner' do |
37 |
| - context 'bob:bob' do |
38 |
| - let :params do |
39 |
| - { |
40 |
| - owner: 'bob', |
41 |
| - group: 'bob' |
42 |
| - } |
43 |
| - end |
44 |
| - |
45 |
| - it do |
46 |
| - expect do |
47 |
| - is_expected.to compile |
48 |
| - end.to raise_error(%r{root user must be used when virtualenv is system}) |
49 |
| - end |
50 |
| - end |
51 |
| - end |
| 23 | + context 'with manage_requirements => false' do |
| 24 | + let(:params) { super().merge(manage_requirements: false) } |
| 25 | + |
| 26 | + it { is_expected.not_to contain_file('/requirements.txt') } |
| 27 | + end |
| 28 | + end |
52 | 29 |
|
53 |
| - describe 'with owner' do |
54 |
| - context 'default' do |
55 |
| - it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } |
56 |
| - end |
| 30 | + describe 'with owner' do |
| 31 | + context 'bob:bob' do |
| 32 | + let :params do |
| 33 | + { |
| 34 | + owner: 'bob', |
| 35 | + group: 'bob' |
| 36 | + } |
57 | 37 | end
|
| 38 | + |
| 39 | + it { is_expected.to compile.and_raise_error(%r{root user must be used when virtualenv is system}) } |
58 | 40 | end
|
59 | 41 | end
|
| 42 | + |
| 43 | + context 'default' do |
| 44 | + it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') } |
| 45 | + end |
60 | 46 | end
|
61 | 47 | end
|
62 | 48 | end
|
0 commit comments