Sha256: 34bd52c5cb156fe8d0ee92d0b0c29a748f7c4566e7c301a497d09ed44e5f3a06

Contents?: true

Size: 1.52 KB

Versions: 4

Compression:

Stored size: 1.52 KB

Contents

require_relative "../../../base"

require Vagrant.source_root.join("plugins/provisioners/chef/omnibus")

describe VagrantPlugins::Chef::Omnibus do
  let(:prefix) { "curl -sL #{described_class.const_get(:OMNITRUCK)}" }

  let(:version) { :latest }
  let(:prerelease) { false }
  let(:download_path) { nil }

  let(:build_command) { described_class.build_command(version, prerelease, download_path) }

  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

  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

  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

  context "when prerelease and version and download_path are given" do
    let(:version) { "1.2.3" }
    let(:prerelease) { true }
    let(:download_path) { "/some/path" }

    it "returns the correct command" do
      expect(build_command).to eq("#{prefix} | sudo bash -s -- -p -v \"1.2.3\" -d \"/some/path\"")
    end
  end
end

Version data entries

4 entries across 1 versions & 1 rubygems

Version Path
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-1cf2a8db4ccb/test/unit/plugins/provisioners/chef/omnibus_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-272fb27e0536/test/unit/plugins/provisioners/chef/omnibus_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-309e896975d1/test/unit/plugins/provisioners/chef/omnibus_test.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-b421af58e8b3/test/unit/plugins/provisioners/chef/omnibus_test.rb