Sha256: 278bd7f1eeaf46e9a3876c3111ae3945b17bad27ec4aa282979760d12c690ef0
Contents?: true
Size: 1.37 KB
Versions: 11
Compression:
Stored size: 1.37 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 # FIXME: This test requires network access. # Which is not airplane hacking friendly. >:p it 'can be queried for upstream entries' do skip("needs network, and I am on an airplane without wifi") 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
11 entries across 11 versions & 1 rubygems