Skip to content

Commit

Permalink
Merge pull request #521 from ekohl/clean-test
Browse files Browse the repository at this point in the history
Clean up requirements_spec.rb
  • Loading branch information
bastelfreak authored Nov 26, 2019
2 parents f5244ac + 1477e6f commit ead6301
Showing 1 changed file with 27 additions and 41 deletions.
68 changes: 27 additions & 41 deletions spec/defines/requirements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

describe 'python::requirements', type: :define do
on_supported_os.each do |os, facts|
context "on #{os} " do
context "on #{os}" do
let :facts do
facts
end
Expand All @@ -11,52 +11,38 @@
'/requirements.txt'
end

context 'on Debian OS' do
describe 'requirements as' do
context '/requirements.txt' do
let :params do
{
requirements: '/requirements.txt'
}
end
context 'with /requirements.txt' do
let :params do
{
requirements: '/requirements.txt'
}
end

it { is_expected.to contain_file('/requirements.txt').with_mode('0644') }
end
context '/requirements.txt' do
let :params do
{
requirements: '/requirements.txt',
manage_requirements: false
}
end

it { is_expected.not_to contain_file('/requirements.txt') }
end
it { is_expected.to contain_file('/requirements.txt').with_mode('0644') }

describe 'with owner' do
context 'bob:bob' do
let :params do
{
owner: 'bob',
group: 'bob'
}
end

it do
expect do
is_expected.to compile
end.to raise_error(%r{root user must be used when virtualenv is system})
end
end
end
context 'with manage_requirements => false' do
let(:params) { super().merge(manage_requirements: false) }

it { is_expected.not_to contain_file('/requirements.txt') }
end
end

describe 'with owner' do
context 'default' do
it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') }
end
describe 'with owner' do
context 'bob:bob' do
let :params do
{
owner: 'bob',
group: 'bob'
}
end

it { is_expected.to compile.and_raise_error(%r{root user must be used when virtualenv is system}) }
end
end

context 'default' do
it { is_expected.to contain_file('/requirements.txt').with_owner('root').with_group('root') }
end
end
end
end

0 comments on commit ead6301

Please sign in to comment.