forked from voxpupuli/puppet-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathpip_version_spec.rb
More file actions
32 lines (28 loc) · 960 Bytes
/
pip_version_spec.rb
File metadata and controls
32 lines (28 loc) · 960 Bytes
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
require 'spec_helper'
describe Facter::Util::Fact do
before do
Facter.clear
end
let(:pip_version_output) do
<<-EOS
pip 6.0.6 from /opt/boxen/homebrew/Cellar/python/2.7.9/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pip-6.0.6-py2.7.egg (python 2.7)
EOS
end
describe 'pip_version' do
context 'returns pip version when pip present' do
it do
Facter::Util::Resolution.stubs(:exec)
Facter::Util::Resolution.expects(:which).with('pip').returns(true)
Facter::Util::Resolution.expects(:exec).with('pip --version 2>&1').returns(pip_version_output)
expect(Facter.value(:pip_version)).to eq('6.0.6')
end
end
context 'returns nil when pip not present' do
it do
Facter::Util::Resolution.stubs(:exec)
Facter::Util::Resolution.expects(:which).with('pip').returns(false)
expect(Facter.value(:pip_version)).to eq(nil)
end
end
end
end