vagrant/test/unit/plugins/provisioners/chef/config/base_test.rb

94 lines
2.0 KiB
Ruby
Raw Normal View History

2014-10-30 15:22:38 +00:00
require_relative "../../../../base"
require Vagrant.source_root.join("plugins/provisioners/chef/config/base")
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
describe "#product" do
it "defaults to \"chef\"" do
subject.finalize!
expect(subject.product).to eq("chef")
end
end
describe "#install" do
it "defaults to true" do
2014-10-30 16:07:42 +00:00
subject.finalize!
expect(subject.install).to be(true)
2014-10-30 16:07:42 +00:00
end
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
describe "#channel" do
it "defaults to \"stable\"" do
subject.finalize!
expect(subject.channel).to eq("stable")
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
end
end
describe "#version" do
it "defaults to :latest" do
2014-10-30 16:07:42 +00:00
subject.finalize!
expect(subject.version).to eq(:latest)
2014-10-30 16:07:42 +00:00
end
2014-10-30 15:22:38 +00:00
it "converts the string 'latest' to a symbol" do
subject.version = "latest"
2014-10-30 16:07:42 +00:00
subject.finalize!
expect(subject.version).to eq(:latest)
2014-10-30 16:07:42 +00:00
end
2014-10-30 15:22:38 +00:00
end
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