Sha256: 109aafb655db398dd11ee43c82db67c56c8c1d7aacc289e1538cb783226ee4d7
Contents?: true
Size: 1.65 KB
Versions: 1
Compression:
Stored size: 1.65 KB
Contents
require 'test_helper' require 'net/dns/resolver' class Net::DNS::Resolver attr_reader :config end class ResolverTest < Test::Unit::TestCase def test_initialize assert_nothing_raised { Net::DNS::Resolver.new } end def test_initialize_with_config assert_nothing_raised { Net::DNS::Resolver.new({}) } end def test_initialize_with_invalid_config_should_raise_argumenterror assert_raise(Net::DNS::Resolver::ArgumentError) { Net::DNS::Resolver.new("") } assert_raise(Net::DNS::Resolver::ArgumentError) { Net::DNS::Resolver.new(0) } assert_raise(Net::DNS::Resolver::ArgumentError) { Net::DNS::Resolver.new(:foo) } end RubyPlatforms = [ ["darwin9.0", false], # Mac OS X ["darwin", false], # JRuby on Mac OS X ["linux-gnu", false], ["mingw32", true], # ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mingw32] ["mswin32", true], # ruby 1.8.6 (2008-03-03 patchlevel 114) [i386-mswin32] ["mswin32", true], # ruby 1.8.6 (2008-04-22 rev 6555) [x86-jruby1.1.1] ] def test_self_platform_windows_question RubyPlatforms.each do |platform, is_windows| assert_equal is_windows, override_platform(platform) { Net::DNS::Resolver.platform_windows? }, "Expected `#{is_windows}' with platform `#{platform}'" end end protected def override_platform(new_platform, &block) raise LocalJumpError, "no block given" unless block_given? old_platform = Config::CONFIG["host_os"] Config::CONFIG["host_os"] = new_platform result = yield ensure Config::CONFIG["host_os"] = old_platform result end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
net-dns-0.6.0 | test/resolver_test.rb |