File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
lib/chef/provider/package
spec/unit/provider/package Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -140,10 +140,11 @@ def install_package(name, version)
140140end
141141
142142def upgrade_package ( name , version )
143- # If we have a version, we can upgrade - otherwise, install
144- if @current_resource . version
143+ # If we're not given a version, running update is the correct
144+ # option. If we are, then running install_package is right.
145+ unless version
145146run_command_with_systems_locale (
146- :command => "yum -d0 -e0 -y update #{ name } - #{ version } "
147+ :command => "yum -d0 -e0 -y update #{ name } "
147148)
148149@yum . flush
149150else
Original file line number Diff line number Diff line change 142142@provider . current_resource = @current_resource
143143end
144144
145- it "should run yum update if the package is installed" do
145+ it "should run yum update if the package is installed and no version is given " do
146146@provider . should_receive ( :run_command_with_systems_locale ) . with ( {
147- :command => "yum -d0 -e0 -y update emacs-11"
147+ :command => "yum -d0 -e0 -y update emacs"
148+ } )
149+ @provider . upgrade_package ( @new_resource . name , nil )
150+ end
151+
152+ it "should run yum install if the package is installed and a version is given" do
153+ @provider . should_receive ( :run_command_with_systems_locale ) . with ( {
154+ :command => "yum -d0 -e0 -y install emacs-11"
148155} )
149156@provider . upgrade_package ( @new_resource . name , @provider . candidate_version )
150157end
You can’t perform that action at this time.
0 commit comments