diff options
author | Dan Bode <bodepd@gmail.com> | 2010-09-07 18:06:09 -0400 |
---|---|---|
committer | Matt Robinson <matt@puppetlabs.com> | 2010-11-23 11:16:48 -0800 |
commit | 9ccd29f3aacdab03f2ea9a693b5bca928439683b (patch) | |
tree | d22579d01f07691f61d5969554cf3549f1eed56c /spec | |
parent | 04389f502787c6569ffcfa89eb63d76c3c63d29c (diff) | |
download | puppet-9ccd29f3aacdab03f2ea9a693b5bca928439683b.tar.gz puppet-9ccd29f3aacdab03f2ea9a693b5bca928439683b.tar.xz puppet-9ccd29f3aacdab03f2ea9a693b5bca928439683b.zip |
(#2866) yum should support downgrade.
patch originally from Grzegorz Nosek with contributions on
the test from Oliver Hookins.
checks if the current version is greater than the should
version, if so, calls yum downgrade.
Reviewed-by: Matt Robinson
Diffstat (limited to 'spec')
-rw-r--r-- | spec/unit/provider/package/yum_spec.rb | 20 |
1 files changed, 13 insertions, 7 deletions
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index 09c81f72f..f6a99aa78 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -31,21 +31,27 @@ describe provider do @provider.expects(:yum).with('-d', '0', '-e', '0', '-y', :install, 'mypackage') @provider.install end - it "should use :install to update" do + it 'should use :install to update' do @provider.expects(:install) @provider.update end - it "should be able to set version" do - @resource.stubs(:should).with(:ensure).returns "1.2" + it 'should be able to set version' do + @resource.stubs(:should).with(:ensure).returns '1.2' @provider.expects(:yum).with('-d', '0', '-e', '0', '-y', :install, 'mypackage-1.2') - @provider.stubs(:query).returns :ensure => '1.2' + @provider.stubs(:query).returns :ensure => '1.2' + @provider.install + end + it 'should be able to downgrade' do + @resource.stubs(:should).with(:ensure).returns '1.0' + @provider.expects(:yum).with('-d', '0', '-e', '0', '-y', :downgrade, 'mypackage-1.0') + @provider.stubs(:query).returns(:ensure => '1.2').then.returns(:ensure => '1.0') @provider.install end end describe 'when uninstalling' do - it "should use erase to purge" do - @provider.expects(:yum).with("-y", :erase, 'mypackage') + it 'should use erase to purge' do + @provider.expects(:yum).with('-y', :erase, 'mypackage') @provider.purge end it 'should use rpm to uninstall' do @@ -54,7 +60,7 @@ describe provider do end end - it "should be versionable" do + it 'should be versionable' do provider.should be_versionable end end |