Sha256: d0612d602bd5e875a4b8df304b4e359e3fbc93d711bd08ebdac81d20323ad0c9

Contents?: true

Size: 1.26 KB

Versions: 9

Compression:

Stored size: 1.26 KB

Contents

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

require "vagrant/util/template_renderer"

describe "templates/guests/debian/network_dhcp" do
  let(:template) { "guests/debian/network_dhcp" }

  it "renders the template" do
    result = Vagrant::Util::TemplateRenderer.render(template, options: {
      device: "eth1",
    })
    expect(result).to eq <<-EOH.gsub(/^ {6}/, "")
      #VAGRANT-BEGIN
      # The contents below are automatically generated by Vagrant. Do not modify.
      auto eth1
      iface eth1 inet dhcp
          post-up route del default dev $IFACE || true
      #VAGRANT-END
    EOH
  end

  context "when use_dhcp_assigned_default_route is set" do
    it "renders the template" do
      result = Vagrant::Util::TemplateRenderer.render(template, options: {
        device: "eth1",
        use_dhcp_assigned_default_route: true,
      })
      expect(result).to eq <<-EOH.gsub(/^ {8}/, "")
        #VAGRANT-BEGIN
        # The contents below are automatically generated by Vagrant. Do not modify.
        auto eth1
        iface eth1 inet dhcp
            # We need to disable eth0, see GH-2648
            post-up route del default dev eth0 || true
            post-up dhclient $IFACE
            pre-down route add default dev eth0
        #VAGRANT-END
      EOH
    end
  end
end

Version data entries

9 entries across 9 versions & 2 rubygems

Version Path
vagrant-unbundled-1.9.1.1 test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-compose-yaml-0.1.3 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-compose-yaml-0.1.2 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-compose-yaml-0.1.1 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-compose-yaml-0.1.0 vendor/bundle/ruby/2.2.0/bundler/gems/vagrant-dbb756c7b6da/test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-unbundled-1.8.5.2 test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-unbundled-1.8.5.1 test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-unbundled-1.8.4.2 test/unit/templates/guests/debian/network_dhcp_test.rb
vagrant-unbundled-1.8.4.1 test/unit/templates/guests/debian/network_dhcp_test.rb