|
43 | 43 | describe 'pip2_version' do |
44 | 44 | context 'returns pip2 version when pip2 present' do |
45 | 45 | it do |
46 | | - Facter::Util::Resolution.stubs(:exec) |
47 | | - Facter::Util::Resolution.expects(:which).with('pip2').returns(true) |
48 | | - Facter::Util::Resolution.expects(:exec).with('pip2 --version 2>&1').returns(pip2_version_output) |
| 46 | + allow(Facter::Util::Resolution).to receive(:which).with('pip2').and_return(true) |
| 47 | + allow(Facter::Util::Resolution).to receive(:exec).with('pip2 --version 2>&1').and_return(pip2_version_output) |
49 | 48 | expect(Facter.value(:pip2_version)).to eq('9.0.1') |
50 | 49 | end |
51 | 50 | end |
52 | 51 |
|
53 | 52 | context 'returns nil when pip2 not present' do |
54 | 53 | it do |
55 | | - Facter::Util::Resolution.stubs(:exec) |
56 | | - Facter::Util::Resolution.expects(:which).with('pip2').returns(false) |
| 54 | + allow(Facter::Util::Resolution).to receive(:which).with('pip2').and_return(false) |
57 | 55 | expect(Facter.value(:pip2_version)).to eq(nil) |
58 | 56 | end |
59 | 57 | end |
|
62 | 60 | describe 'pip3_version' do |
63 | 61 | context 'returns pip3 version when pip3 present' do |
64 | 62 | it do |
65 | | - Facter::Util::Resolution.stubs(:exec) |
66 | | - Facter::Util::Resolution.expects(:which).with('pip3').returns(true) |
67 | | - Facter::Util::Resolution.expects(:exec).with('pip3 --version 2>&1').returns(pip3_version_output) |
| 63 | + allow(Facter::Util::Resolution).to receive(:which).with('pip3').and_return(true) |
| 64 | + allow(Facter::Util::Resolution).to receive(:exec).with('pip3 --version 2>&1').and_return(pip3_version_output) |
68 | 65 | expect(Facter.value(:pip3_version)).to eq('18.1') |
69 | 66 | end |
70 | 67 | end |
71 | 68 |
|
72 | 69 | context 'returns nil when pip3 not present' do |
73 | 70 | it do |
74 | | - Facter::Util::Resolution.stubs(:exec) |
75 | | - Facter::Util::Resolution.expects(:which).with('pip3').returns(false) |
| 71 | + allow(Facter::Util::Resolution).to receive(:which).with('pip3').and_return(false) |
76 | 72 | expect(Facter.value(:pip3_version)).to eq(nil) |
77 | 73 | end |
78 | 74 | end |
|
0 commit comments