2014-10-30 15:22:38 +00:00
|
|
|
require_relative "../../../../base"
|
|
|
|
|
|
|
|
require Vagrant.source_root.join("plugins/provisioners/chef/config/base")
|
|
|
|
|
2014-10-30 15:41:50 +00:00
|
|
|
describe VagrantPlugins::Chef::Config::Base do
|
2014-10-30 15:22:38 +00:00
|
|
|
include_context "unit"
|
|
|
|
|
|
|
|
subject { described_class.new }
|
|
|
|
|
|
|
|
let(:machine) { double("machine") }
|
|
|
|
|
|
|
|
describe "#binary_path" do
|
2014-10-30 16:07:42 +00:00
|
|
|
it "defaults to nil" do
|
|
|
|
subject.finalize!
|
|
|
|
expect(subject.binary_path).to be(nil)
|
|
|
|
end
|
2014-10-30 15:22:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#binary_env" do
|
2014-10-30 16:07:42 +00:00
|
|
|
it "defaults to nil" do
|
|
|
|
subject.finalize!
|
|
|
|
expect(subject.binary_env).to be(nil)
|
|
|
|
end
|
2014-10-30 15:22:38 +00:00
|
|
|
end
|
|
|
|
|
2015-11-19 22:57:01 +00:00
|
|
|
describe "#product" do
|
|
|
|
it "defaults to \"chef\"" do
|
|
|
|
subject.finalize!
|
|
|
|
expect(subject.product).to eq("chef")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-31 18:22:40 +00:00
|
|
|
describe "#install" do
|
|
|
|
it "defaults to true" do
|
2014-10-30 16:07:42 +00:00
|
|
|
subject.finalize!
|
2014-10-31 18:22:40 +00:00
|
|
|
expect(subject.install).to be(true)
|
2014-10-30 16:07:42 +00:00
|
|
|
end
|
2014-10-31 20:06:05 +00:00
|
|
|
|
|
|
|
it "is converted to a symbol" do
|
|
|
|
subject.install = "force"
|
|
|
|
subject.finalize!
|
|
|
|
expect(subject.install).to eq(:force)
|
|
|
|
end
|
2014-10-30 15:22:38 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
describe "#log_level" do
|
2014-10-30 16:07:42 +00:00
|
|
|
it "defaults to :info" do
|
|
|
|
subject.finalize!
|
|
|
|
expect(subject.log_level).to be(:info)
|
|
|
|
end
|
|
|
|
|
|
|
|
it "is converted to a symbol" do
|
|
|
|
subject.log_level = "foo"
|
|
|
|
subject.finalize!
|
|
|
|
expect(subject.log_level).to eq(:foo)
|
|
|
|
end
|
2014-10-30 15:22:38 +00:00
|
|
|
end
|
|
|
|
|
2015-11-19 22:57:01 +00:00
|
|
|
describe "#channel" do
|
2016-02-08 15:48:22 +00:00
|
|
|
it "defaults to \"stable\"" do
|
2014-10-31 20:06:05 +00:00
|
|
|
subject.finalize!
|
2016-02-08 15:48:22 +00:00
|
|
|
expect(subject.channel).to eq("stable")
|
2015-11-19 22:57:01 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
describe "#prerelease" do
|
|
|
|
it "should not exist in Vagrant 1.9" do
|
|
|
|
if Vagrant::VERSION >= "1.9"
|
|
|
|
raise "This option should be removed!"
|
|
|
|
end
|
2014-10-31 20:06:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-31 18:22:40 +00:00
|
|
|
describe "#version" do
|
|
|
|
it "defaults to :latest" do
|
2014-10-30 16:07:42 +00:00
|
|
|
subject.finalize!
|
2014-10-31 18:22:40 +00:00
|
|
|
expect(subject.version).to eq(:latest)
|
2014-10-30 16:07:42 +00:00
|
|
|
end
|
2014-10-30 15:22:38 +00:00
|
|
|
|
2014-10-31 18:22:40 +00:00
|
|
|
it "converts the string 'latest' to a symbol" do
|
|
|
|
subject.version = "latest"
|
2014-10-30 16:07:42 +00:00
|
|
|
subject.finalize!
|
2014-10-31 18:22:40 +00:00
|
|
|
expect(subject.version).to eq(:latest)
|
2014-10-30 16:07:42 +00:00
|
|
|
end
|
2014-10-30 15:22:38 +00:00
|
|
|
end
|
2014-12-16 21:40:19 +00:00
|
|
|
|
|
|
|
describe "#installer_download_path" do
|
|
|
|
it "defaults to nil" do
|
|
|
|
subject.finalize!
|
|
|
|
expect(subject.installer_download_path).to be(nil)
|
|
|
|
end
|
|
|
|
end
|
2014-10-30 15:22:38 +00:00
|
|
|
end
|