2014-10-31 20:06:05 +00:00
|
|
|
require_relative "../../../base"
|
|
|
|
|
|
|
|
require Vagrant.source_root.join("plugins/provisioners/chef/omnibus")
|
|
|
|
|
2015-01-07 20:51:55 +00:00
|
|
|
describe VagrantPlugins::Chef::Omnibus do
|
2014-10-31 20:06:05 +00:00
|
|
|
let(:prefix) { "curl -sL #{described_class.const_get(:OMNITRUCK)}" }
|
|
|
|
|
|
|
|
let(:version) { :latest }
|
|
|
|
let(:prerelease) { false }
|
2014-12-16 22:29:47 +00:00
|
|
|
let(:download_path) { nil }
|
2014-10-31 20:06:05 +00:00
|
|
|
|
2014-12-16 22:29:47 +00:00
|
|
|
let(:build_command) { described_class.build_command(version, prerelease, download_path) }
|
2014-10-31 20:06:05 +00:00
|
|
|
|
|
|
|
context "when prerelease is given" do
|
|
|
|
let(:prerelease) { true }
|
|
|
|
|
|
|
|
it "returns the correct command" do
|
|
|
|
expect(build_command).to eq("#{prefix} | sudo bash -s -- -p")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-12-16 22:29:47 +00:00
|
|
|
context "when download_path is given" do
|
|
|
|
let(:download_path) { '/tmp/path/to/omnibuses' }
|
|
|
|
|
|
|
|
it "returns the correct command" do
|
|
|
|
expect(build_command).to eq("#{prefix} | sudo bash -s -- -d \"/tmp/path/to/omnibuses\"")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-10-31 20:06:05 +00:00
|
|
|
context "when version is :latest" do
|
|
|
|
let(:version) { :latest }
|
|
|
|
|
|
|
|
it "returns the correct command" do
|
|
|
|
expect(build_command).to eq("#{prefix} | sudo bash")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
context "when version is a string" do
|
|
|
|
let(:version) { "1.2.3" }
|
|
|
|
|
|
|
|
it "returns the correct command" do
|
|
|
|
expect(build_command).to eq("#{prefix} | sudo bash -s -- -v \"1.2.3\"")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2014-12-16 22:29:47 +00:00
|
|
|
context "when prerelease and version and download_path are given" do
|
2014-10-31 20:06:05 +00:00
|
|
|
let(:version) { "1.2.3" }
|
|
|
|
let(:prerelease) { true }
|
2014-12-16 22:29:47 +00:00
|
|
|
let(:download_path) { "/some/path" }
|
2014-10-31 20:06:05 +00:00
|
|
|
|
|
|
|
it "returns the correct command" do
|
2014-12-16 22:29:47 +00:00
|
|
|
expect(build_command).to eq("#{prefix} | sudo bash -s -- -p -v \"1.2.3\" -d \"/some/path\"")
|
2014-10-31 20:06:05 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|