Sha256: e2ff14223486d0b69c0eb475e7edeff1ed3176f16f729be37db88980013f0540

Contents?: true

Size: 1.02 KB

Versions: 62

Compression:

Stored size: 1.02 KB

Contents

require 'em_test_helper'

class TestResolver < Test::Unit::TestCase
  def test_a
    EM.run {
      d = EM::DNS::Resolver.resolve "google.com"
      d.errback { assert false }
      d.callback { |r|
        assert r
        EM.stop
      }
    }
  end

  def test_bad_host
    EM.run {
      d = EM::DNS::Resolver.resolve "asdfasasdf"
      d.callback { assert false }
      d.errback  { assert true; EM.stop }
    }
  end

  def test_garbage
    assert_raises( ArgumentError ) {
      EM.run {
        EM::DNS::Resolver.resolve 123
      }
    }
  end

  def test_a_pair
    EM.run {
      d = EM::DNS::Resolver.resolve "google.com"
      d.errback { assert false }
      d.callback { |r|
        assert_equal(Array, r.class)
        assert r.size > 1
        EM.stop
      }
    }
  end

  def test_localhost
    EM.run {
      d = EM::DNS::Resolver.resolve "localhost"
      d.errback { assert false }
      d.callback { |r|
        assert_equal("127.0.0.1", r.first)
        assert_equal(Array, r.class)

        EM.stop
      }
    }
  end
end

Version data entries

62 entries across 62 versions & 4 rubygems

Version Path
sensu-em-2.4.1-java tests/test_resolver.rb
sensu-em-2.4.1 tests/test_resolver.rb
eventmachine-1.0.4-java tests/test_resolver.rb
eventmachine-1.0.4 tests/test_resolver.rb
sensu-em-2.4.0-x86-mingw32 tests/test_resolver.rb
sonixlabs-eventmachine-java-1.0.3.2-java tests/test_resolver.rb
sonixlabs-eventmachine-java-1.0.3.1-java tests/test_resolver.rb
sonixlabs-eventmachine-java-1.0.3.1 tests/test_resolver.rb
sensu-em-2.4.0-java tests/test_resolver.rb
sensu-em-2.4.0 tests/test_resolver.rb
sensu-em-2.3.0-java tests/test_resolver.rb
sensu-em-2.3.0 tests/test_resolver.rb
sensu-em-2.2.0-java tests/test_resolver.rb
sensu-em-2.2.0 tests/test_resolver.rb
sensu-em-2.1.0-java tests/test_resolver.rb
sensu-em-2.1.0 tests/test_resolver.rb
sensu-em-2.0.0-java tests/test_resolver.rb
sensu-em-2.0.0 tests/test_resolver.rb
sonixlabs-eventmachine-java-1.0.0.rc.7-java tests/test_resolver.rb
eventmachine-1.0.3-x86-mswin32-60 tests/test_resolver.rb