forked from voxpupuli/puppet-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfacts_test_spec.rb
More file actions
44 lines (39 loc) · 1.52 KB
/
facts_test_spec.rb
File metadata and controls
44 lines (39 loc) · 1.52 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
require 'spec_helper_acceptance'
describe 'python class' do
context 'facts' do
install_python = <<-EOS
class { 'python' :
version => 'system',
pip => 'present',
virtualenv => 'present',
}
EOS
fact_notices = <<-EOS
notify{"pip_version: ${::pip_version}":}
notify{"system_python_version: ${::system_python_version}":}
notify{"python_version: ${::python_version}":}
notify{"virtualenv_version: ${::virtualenv_version}":}
EOS
# rubocop:disable RSpec/RepeatedExample
it 'outputs python facts when not installed' do # rubocop:disable RSpec/MultipleExpectations
apply_manifest(fact_notices, catch_failures: true) do |r|
expect(r.stdout).to match(%r{python_version: \S+})
expect(r.stdout).to match(%r{pip_version: \S+})
expect(r.stdout).to match(%r{virtualenv_version: \S+})
expect(r.stdout).to match(%r{system_python_version: \S+})
end
end
it 'sets up python' do
apply_manifest(install_python, catch_failures: true)
end
it 'outputs python facts when installed' do # rubocop:disable RSpec/MultipleExpectations
apply_manifest(fact_notices, catch_failures: true) do |r|
expect(r.stdout).to match(%r{python_version: \S+})
expect(r.stdout).to match(%r{pip_version: \S+})
expect(r.stdout).to match(%r{virtualenv_version: \S+})
expect(r.stdout).to match(%r{system_python_version: \S+})
end
end
# rubocop:enable RSpec/RepeatedExample
end
end