Sha256: c700ebeffdcd84d1a34186b675fab54b0f2c0f03d24c7a999bbeb1154f5f7960

Contents?: true

Size: 1.39 KB

Versions: 11

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

11 entries across 11 versions & 2 rubygems

Version Path
vagrant-unbundled-2.2.19.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.18.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.16.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.14.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.10.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.9.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.8.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-2.2.7.0 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-1.9.5.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-unbundled-1.9.1.1 vendor/bundle/ruby/2.4.0/bundler/gems/vagrant-spec-9bba7e122837/acceptance/cli/init_spec.rb
vagrant-cloudstack-1.1.0 vendor/bundle/bundler/gems/vagrant-spec-1df5a3af81cb/acceptance/cli/init_spec.rb