Sha256: 49bed4391015bc26cc2c3af27444c0a866f416ececaa2e45f1e4a8ccbd394115
Contents?: true
Size: 1.19 KB
Versions: 7
Compression:
Stored size: 1.19 KB
Contents
require 'test_helper' module Landrush describe Server do def query(host) output = `dig -p #{Server.port} @127.0.0.1 #{host}` answer_line = output.split("\n").grep(/^#{Regexp.escape(host)}/).first answer_line.split.last end describe 'start/stop' do it 'starts and stops a daemon' do Server.start Server.running?.must_equal true Server.stop Server.running?.must_equal false end it 'can be queried for upstream entries' do Server.start query("phinze.com").must_match(/\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}/) end it 'responds properly to configured machine entries' do Server.start fake_host = 'boogers.vagrant.dev' fake_ip = '99.98.97.96' Store.hosts.set(fake_host, fake_ip) query(fake_host).must_equal fake_ip end it 'also resolves wildcard subdomains to a given machine' do Server.start fake_host = 'boogers.vagrant.dev' fake_ip = '99.98.97.96' Store.hosts.set(fake_host, fake_ip) query("green.#{fake_host}").must_match(fake_ip) query("blue.#{fake_host}").must_match(fake_ip) end end end end
Version data entries
7 entries across 7 versions & 1 rubygems