summaryrefslogtreecommitdiff
path: root/spec/unit/resource/alternatives_spec.rb
diff options
context:
space:
mode:
authorTim Smith <tsmith84@gmail.com>2020-03-12 16:47:55 -0700
committerTim Smith <tsmith84@gmail.com>2020-03-12 16:47:55 -0700
commit03d92084982f7e69d251cf4c9fd90059ac6f8ef5 (patch)
tree580618ce2567e285053f2b23c950b408833bf699 /spec/unit/resource/alternatives_spec.rb
parent9d1d8cb8223cba771591de399bcdc97a3d618ee7 (diff)
downloadchef-03d92084982f7e69d251cf4c9fd90059ac6f8ef5.tar.gz
Add the final two sets of specs
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'spec/unit/resource/alternatives_spec.rb')
-rw-r--r--spec/unit/resource/alternatives_spec.rb14
1 files changed, 14 insertions, 0 deletions
diff --git a/spec/unit/resource/alternatives_spec.rb b/spec/unit/resource/alternatives_spec.rb
index d1e03e0b1a..d8e7977125 100644
--- a/spec/unit/resource/alternatives_spec.rb
+++ b/spec/unit/resource/alternatives_spec.rb
@@ -77,6 +77,20 @@ describe Chef::Resource::Alternatives do
end
end
+ describe "#current_path" do
+ it "extracts the current path by running alternatives --display" do
+ allow(provider).to receive(:shell_out).with("alternatives", "--display", "fakey_fakerton").and_return(alternatives_display_exists)
+ expect(provider.current_path).to eql("/usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java")
+ end
+ end
+
+ describe "#path_priority" do
+ it "extracts the path priority by running alternatives --display" do
+ allow(provider).to receive(:shell_out).with("alternatives", "--display", "fakey_fakerton").and_return(alternatives_display_exists)
+ expect(provider.path_priority).to eql(1081)
+ end
+ end
+
describe "#alternatives_cmd" do
it "returns alternatives on fedora" do
node.automatic_attrs[:platform_family] = "fedora"