diff --git a/spec/defines/pyvenv_spec.rb b/spec/defines/pyvenv_spec.rb index 55bfd371..b19a0317 100644 --- a/spec/defines/pyvenv_spec.rb +++ b/spec/defines/pyvenv_spec.rb @@ -4,8 +4,8 @@ let (:title) { '/opt/env' } it { - should contain_file( '/opt/env') - should contain_exec( "python_virtualenv_/opt/env").with_command("pyvenv --clear /opt/env") + is_expected.to contain_file( '/opt/env') + is_expected.to contain_exec( "python_virtualenv_/opt/env").with_command("pyvenv --clear /opt/env") } describe 'when ensure' do @@ -14,7 +14,7 @@ :ensure => 'absent' }} it { - should contain_file( '/opt/env').with_ensure('absent').with_purge( true) + is_expected.to contain_file( '/opt/env').with_ensure('absent').with_purge( true) } end end diff --git a/spec/defines/requirements_spec.rb b/spec/defines/requirements_spec.rb index e1cdc28b..08abdbd9 100644 --- a/spec/defines/requirements_spec.rb +++ b/spec/defines/requirements_spec.rb @@ -30,7 +30,7 @@ }} it do expect { - should compile + is_expected.to compile }.to raise_error(/root user must be used when virtualenv is system/) end end diff --git a/spec/unit/facter/pip_version_spec.rb b/spec/unit/facter/pip_version_spec.rb index 2c75cbf0..63a6187b 100644 --- a/spec/unit/facter/pip_version_spec.rb +++ b/spec/unit/facter/pip_version_spec.rb @@ -16,7 +16,7 @@ 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) - Facter.value(:pip_version).should == "6.0.6" + expect(Facter.value(:pip_version)).to eq("6.0.6") end end @@ -24,7 +24,7 @@ it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("pip").returns(false) - Facter.value(:pip_version).should == nil + expect(Facter.value(:pip_version)).to eq(nil) end end diff --git a/spec/unit/facter/python_version_spec.rb b/spec/unit/facter/python_version_spec.rb index 80aadae8..48ab1ede 100644 --- a/spec/unit/facter/python_version_spec.rb +++ b/spec/unit/facter/python_version_spec.rb @@ -20,7 +20,7 @@ Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("python").returns(true) Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) - Facter.value(:python_version).should == "2.7.9" + expect(Facter.value(:python_version)).to eq("2.7.9") end end @@ -28,7 +28,7 @@ it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("python").returns(false) - Facter.value(:python_version).should == nil + expect(Facter.value(:python_version)).to eq(nil) end end @@ -40,7 +40,7 @@ Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("python").returns(true) Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python2_version_output) - Facter.value(:python2_version).should == '2.7.9' + expect(Facter.value(:python2_version)).to eq('2.7.9') end end @@ -51,38 +51,38 @@ Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) Facter::Util::Resolution.expects(:which).with("python2").returns(true) Facter::Util::Resolution.expects(:exec).with("python2 -V 2>&1").returns(python2_version_output) - Facter.value(:python2_version).should == '2.7.9' + expect(Facter.value(:python2_version)).to eq('2.7.9') end end - + context 'returns nil when `python` is Python 3 and `python2` is absent' do it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("python").returns(true) Facter::Util::Resolution.expects(:exec).with("python -V 2>&1").returns(python3_version_output) Facter::Util::Resolution.expects(:which).with("python2").returns(false) - Facter.value(:python2_version).should == nil + expect(Facter.value(:python2_version)).to eq(nil) end end - + context 'returns nil when `python2` and `python` are absent' do it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("python").returns(false) Facter::Util::Resolution.expects(:which).with("python2").returns(false) - Facter.value(:python2_version).should == nil + expect(Facter.value(:python2_version)).to eq(nil) end end end - + describe "python3_version" do context 'returns Python 3 version when `python3` present' do it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("python3").returns(true) Facter::Util::Resolution.expects(:exec).with("python3 -V 2>&1").returns(python3_version_output) - Facter.value(:python3_version).should == "3.3.0" + expect(Facter.value(:python3_version)).to eq("3.3.0") end end @@ -90,7 +90,7 @@ it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("python3").returns(false) - Facter.value(:python3_version).should == nil + expect(Facter.value(:python3_version)).to eq(nil) end end diff --git a/spec/unit/facter/virtualenv_version_spec.rb b/spec/unit/facter/virtualenv_version_spec.rb index 9f1cc921..b9aac90e 100644 --- a/spec/unit/facter/virtualenv_version_spec.rb +++ b/spec/unit/facter/virtualenv_version_spec.rb @@ -16,7 +16,7 @@ Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("virtualenv").returns(true) Facter::Util::Resolution.expects(:exec).with("virtualenv --version 2>&1").returns(virtualenv_version_output) - Facter.value(:virtualenv_version).should == "12.0.7" + expect(Facter.value(:virtualenv_version)).to eq("12.0.7") end end @@ -24,7 +24,7 @@ it do Facter::Util::Resolution.stubs(:exec) Facter::Util::Resolution.expects(:which).with("virtualenv").returns(false) - Facter.value(:virtualenv_version).should == nil + expect(Facter.value(:virtualenv_version)).to eq(nil) end end