Sha256: f3f4ed59ff966c3d84e722d3f431bca6201c7720183433aa23f96c7ae3b64c37

Contents?: true

Size: 955 Bytes

Versions: 1

Compression:

Stored size: 955 Bytes

Contents

require 'test_helper'

describe Landrush::Cap::Linux::ConfiguredDnsServers do
  let(:machine) { fake_machine }

  before do
    Landrush::Cap::Linux::ConfiguredDnsServers.instance_variable_set("@dns_servers", nil)
  end

  describe 'configured_dns_servers' do
    it 'parses out a single resolv.conf dns server' do
      machine.communicate.stubs(:sudo).yields(:stdout, "nameserver 12.23.34.45")

      dns_servers = Landrush::Cap::Linux::ConfiguredDnsServers.configured_dns_servers(machine)

      dns_servers.must_equal(["12.23.34.45"])
    end

    it 'parses out multiple the resolv.conf dns servers' do
      machine.communicate.stubs(:sudo).yields(:stdout, [
        "nameserver 12.23.34.45",
        "nameserver    45.34.23.12"
      ].join("\n"))

      dns_servers = Landrush::Cap::Linux::ConfiguredDnsServers.configured_dns_servers(machine)

      dns_servers.must_equal([
        "12.23.34.45",
        "45.34.23.12"
      ])
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
landrush-1.0.0 test/landrush/cap/linux/configured_dns_servers_test.rb