Sha256: 179d53f7324fec566e7a80d3469b87a1946114cbb774d451d7ddb36b52ddaf41

Contents?: true

Size: 1.39 KB

Versions: 85

Compression:

Stored size: 1.39 KB

Contents

describe "vagrant CLI: init", component: "cli/init" do
  include_context "acceptance"

  it "creates a Vagrantfile in the working directory" do
    vagrantfile = environment.workdir.join("Vagrantfile")
    expect(vagrantfile.exist?).to_not be(true)

    assert_execute("vagrant", "init")
    expect(vagrantfile.exist?).to be(true)
  end

  it "creates a Vagrantfile with the box set to the given argument" do
    vagrantfile = environment.workdir.join("Vagrantfile")

    assert_execute("vagrant", "init", "foo")
    vagrantfile.read.should match(/config.vm.box = "foo"$/)
  end

  it "creates a Vagrantfile with the box URL set to the given argument" do
    vagrantfile = environment.workdir.join("Vagrantfile")

    assert_execute("vagrant", "init", "foo", "bar")

    contents = vagrantfile.read
    expect(contents).to match(/config.vm.box = "foo"$/)
    expect(contents).to match(/config.vm.box_url = "bar"$/)
  end

  it "outputs the Vagrantfile to another location if specified" do
    vagrantfile = environment.workdir.join("foo")

    assert_execute("vagrant", "init", "--output", "foo")
    expect(vagrantfile.exist?).to be(true)
    expect(vagrantfile.read).to match(/^Vagrant\.configure/)
  end

  it "outputs the Vagrantfile to stdout if specified" do
    result = execute("vagrant", "init", "--output", "-")
    expect(result).to exit_with(0)
    expect(result.stdout).to match(/^Vagrant\.configure/)
  end
end

Version data entries

85 entries across 27 versions & 1 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-1d09951eaef3/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-148cb63d6d06/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-03d88fe24677/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-93c587f3c98a/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/3.0.0/bundler/gems/vagrant-spec-b6b56c8b8135/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.7.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.6.0/bundler/gems/vagrant-spec-abfc34474d12/acceptance/cli/init_spec.rb