summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLamont Granquist <lamont@scriptkiddie.org>2015-08-13 12:48:37 -0700
committerLamont Granquist <lamont@scriptkiddie.org>2015-08-20 00:18:58 -0700
commitb3b4c0766c2ec8a5cb6cb3551ebb4693a07b2dfd (patch)
tree7955cc6e8a8d4a69891bb9b610f66ddab4ccc13b
parentf3fdacc7193c58ce641891942a315f61b4bc87fc (diff)
downloadchef-b3b4c0766c2ec8a5cb6cb3551ebb4693a07b2dfd.tar.gz
add spec for resource side
-rw-r--r--spec/unit/resource/yum_package_spec.rb21
1 files changed, 20 insertions, 1 deletions
diff --git a/spec/unit/resource/yum_package_spec.rb b/spec/unit/resource/yum_package_spec.rb
index e01b87c580..79fc1965b9 100644
--- a/spec/unit/resource/yum_package_spec.rb
+++ b/spec/unit/resource/yum_package_spec.rb
@@ -1,6 +1,6 @@
#
# Author:: AJ Christensen (<aj@opscode.com>)
-# Copyright:: Copyright (c) 2008 Opscode, Inc.
+# Copyright:: Copyright (c) 2008-2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
@@ -78,3 +78,22 @@ describe Chef::Resource::YumPackage, "allow_downgrade" do
expect { @resource.allow_downgrade "monkey" }.to raise_error(ArgumentError)
end
end
+
+describe Chef::Resource::YumPackage, "yum_binary" do
+ let(:resource) { Chef::Resource::YumPackage.new("foo") }
+
+ it "defaults to yum if yum-deprecated does not exist" do
+ expect(::File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(false)
+ expect(resource.yum_binary).to eql("yum")
+ end
+
+ it "defaults to yum-deprecated if yum-deprecated does exist" do
+ expect(::File).to receive(:exist?).with("/usr/bin/yum-deprecated").and_return(true)
+ expect(resource.yum_binary).to eql("yum-deprecated")
+ end
+
+ it "should allow you to specify whether allow_downgrade is true or false" do
+ resource.yum_binary "/usr/bin/yum-something"
+ expect(resource.yum_binary).to eql("/usr/bin/yum-something")
+ end
+end