|
35 | 35 | end |
36 | 36 |
|
37 | 37 | describe "python2_version" do |
38 | | - context 'returns Python 2 version when `python2` is present' do |
| 38 | + context 'returns Python 2 version when `python` is present and Python 2' do |
39 | 39 | it do |
40 | 40 | Facter::Util::Resolution.stubs(:exec) |
41 | | - Facter::Util::Resolution.expects(:which).with("python2").returns(true) |
42 | | - Facter::Util::Resolution.expects(:exec).with("python2 -V 2>&1").returns(python2_version_output) |
| 41 | + Facter::Util::Resolution.expects(:which).with("python").returns(true) |
| 42 | + Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) |
43 | 43 | Facter.value(:python2_version).should == '2.7.9' |
44 | 44 | end |
45 | 45 | end |
46 | 46 |
|
47 | | - context 'returns Python 2 version when `python2` is absent and `python` is Python 2' do |
| 47 | + context 'returns Python 2 version when `python` is Python 3 and `python2` is present' do |
48 | 48 | it do |
49 | 49 | Facter::Util::Resolution.stubs(:exec) |
50 | | - Facter::Util::Resolution.expects(:which).with("python2").returns(false) |
51 | 50 | Facter::Util::Resolution.expects(:which).with("python").returns(true) |
52 | | - Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) |
| 51 | + Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) |
| 52 | + Facter::Util::Resolution.expects(:which).with("python2").returns(true) |
| 53 | + Facter::Util::Resolution.expects(:exec).with("python2 -V 2>&1").returns(python2_version_output) |
53 | 54 | Facter.value(:python2_version).should == '2.7.9' |
54 | 55 | end |
55 | 56 | end |
56 | 57 |
|
57 | | - context 'returns nil when `python2` is absent and `python` is Python 3' do |
| 58 | + context 'returns nil when `python` is Python 3 and `python2` is absent' do |
58 | 59 | it do |
59 | 60 | Facter::Util::Resolution.stubs(:exec) |
60 | | - Facter::Util::Resolution.expects(:which).with("python2").returns(false) |
61 | 61 | Facter::Util::Resolution.expects(:which).with("python").returns(true) |
62 | 62 | Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) |
| 63 | + Facter::Util::Resolution.expects(:which).with("python2").returns(false) |
63 | 64 | Facter.value(:python2_version).should == nil |
64 | 65 | end |
65 | 66 | end |
|
0 commit comments