require_relative '../spec_helper'

describe 'dhcp::default' do
  let(:chef_run) do
    ChefSpec::Runner.new do |node|
      node.set["dhcp"] ={
        domain: {
          names: ["foo"],
          servers: ["node0.foo"]
        },
        ntp_servers: ["foo.lctp"],
        interfaces: ["eth1"],
        subnet: {
          gateway: "172.28.128.1",
          prefix: "172.28.128.0",
          netmask: "255.255.255.0"
        },
        hosts: {
          node1: {
            mac: "5c:a1:ab:1e:00:02"
          }
        }
      }
    end.converge(described_recipe)
  end

  it "should setup dhcp" do
    chef_run.should render_file("/etc/dhcp/dhcpd.conf").with_content("node0")
    chef_run.should install_package("isc-dhcp-server")
  end
end
