Sha256: b9f26ae927a5aaadfd11c5b0e6d7059be4ca2e43971b479b09ca1679b031898b

Contents?: true

Size: 836 Bytes

Versions: 3

Compression:

Stored size: 836 Bytes

Contents

require 'test_helper'

class WhoisTest < Test::Unit::TestCase
  
  def setup
    @server = Whois::Server.factory(:tld, ".it", "whois.nic.it")
    @answer = Whois::Answer.new("", @server)
  end
  
  def test_query
    Whois::Client.any_instance.expects(:query).with("foo.com")
    Whois.query("foo.com")
  end

  def test_whois
    Whois::Client.any_instance.expects(:query).with("foo.com")
    Whois.whois("foo.com")
  end

  def test_available_question
    @answer.expects(:available?).returns(true)
    Whois::Client.any_instance.expects(:query).with("foo.com").returns(@answer)
    assert Whois.available?("foo.com")
  end

  def test_registered_question
    @answer.expects(:registered?).returns(true)
    Whois::Client.any_instance.expects(:query).with("foo.com").returns(@answer)
    assert Whois.registered?("foo.com")
  end

end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
whois-0.9.0 test/whois_test.rb
whois-0.8.1 test/whois_test.rb
whois-0.8.0 test/whois_test.rb