diff options
author | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-03-12 14:20:45 -0700 |
---|---|---|
committer | Jay Mundrawala <jdmundrawala@gmail.com> | 2015-03-12 14:20:45 -0700 |
commit | 7d2f9046342592571d30605fd1ef4f2ec4bc9281 (patch) | |
tree | 4896888ecb6c3e709c98c1f83d98792d47390e90 | |
parent | fc9d8d52b517041e469969e41e22bd1ec90bbc09 (diff) | |
download | chef-jdm/yum.tar.gz |
Assert that candidate_version gets set when yum resource uses sourcejdm/yum
-rw-r--r-- | spec/unit/provider/package/yum_spec.rb | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/provider/package/yum_spec.rb b/spec/unit/provider/package/yum_spec.rb index cd2b3decf4..865dce23fa 100644 --- a/spec/unit/provider/package/yum_spec.rb +++ b/spec/unit/provider/package/yum_spec.rb @@ -73,6 +73,20 @@ describe Chef::Provider::Package::Yum do expect(@provider.load_current_resource).to eql(@provider.current_resource) end + describe "when source is provided" do + it "should set the candidate version" do + @new_resource = Chef::Resource::YumPackage.new('testing.source') + @new_resource.source "chef-server-core-12.0.5-1.rpm" + @provider = Chef::Provider::Package::Yum.new(@new_resource, @run_context) + allow(File).to receive(:exists?).with(@new_resource.source).and_return(true) + allow(@yum_cache).to receive(:installed_version).and_return(nil) + shellout_double = double(:stdout => 'chef-server-core 12.0.5-1') + allow(@provider).to receive(:shell_out!).and_return(shellout_double) + @provider.load_current_resource + expect(@provider.candidate_version).to eql('12.0.5-1') + end + end + describe "when arch in package_name" do it "should set the arch if no existing package_name is found and new_package_name+new_arch is available" do @new_resource = Chef::Resource::YumPackage.new('testing.noarch') |