Skip to content

Commit

Permalink
Merge pull request #250 from tremblaysimon/fixRSpecDeprecation
Browse files Browse the repository at this point in the history
Fix RSpec deprecated messages
  • Loading branch information
Shiva Poudel committed Sep 18, 2015
2 parents 27e31c2 + 163e1da commit 830cf75
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 19 deletions.
6 changes: 3 additions & 3 deletions spec/defines/pyvenv_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
2 changes: 1 addition & 1 deletion spec/defines/requirements_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions spec/unit/facter/pip_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
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

context 'returns nil when pip not present' do
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

Expand Down
22 changes: 11 additions & 11 deletions spec/unit/facter/python_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,15 +20,15 @@
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

context 'returns nil when `python` not present' do
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

Expand All @@ -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

Expand All @@ -51,46 +51,46 @@
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

context 'returns nil when `python3` not present' do
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

Expand Down
4 changes: 2 additions & 2 deletions spec/unit/facter/virtualenv_version_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@
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

context 'returns nil when virtualenv not present' do
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

Expand Down

0 comments on commit 830cf75

Please sign in to comment.