Sha256: 636350794880348db037e468b52bfc527386c14a22cdc55bd70ed94fab2c7d70

Contents?: true

Size: 696 Bytes

Versions: 1

Compression:

Stored size: 696 Bytes

Contents

require 'spec_helper'
require 'resolv'

describe Celluloid::DNS::Server do
  let(:example_host) { '127.0.0.1' }
  let(:example_port) { 54321 }
  let(:example_name) { 'example.com' }
  let(:example_ip)   { '1.2.3.4' }
  
  it "answers DNS requests" do
    server = Celluloid::DNS::Server.new(example_host, example_port) do |request|
      question = request.questions.first

      question.name.should == example_name
      request.answer(question => example_ip)
    end
    
    begin
      Resolv::DNS.open(nameserver_port: [[example_host, example_port]]) do |resolv|
        resolv.getaddress(example_name).to_s.should eq example_ip
      end
    ensure
      server.terminate
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
celluloid-dns-0.0.1 spec/celluloid/dns/server_spec.rb