Sha256: c1653311f0b4175b6b47efb158640fe9944854c66adbd4233f77cbb6f31cd885

Contents?: true

Size: 820 Bytes

Versions: 8

Compression:

Stored size: 820 Bytes

Contents

require 'minitest/autorun'
require 'legitbot'

class BotMatchTest < Minitest::Test
  def test_reverse_name
    match = Legitbot::BotMatch.new "66.249.64.141"
    assert_equal "crawl-66-249-64-141.googlebot.com", match.reverse_name
  end

  def test_reverse_ip
    match = Legitbot::BotMatch.new "66.249.64.141"
    assert_equal "66.249.64.141", match.reversed_ip
  end

  def test_reverse_resolves
    match = Legitbot::BotMatch.new "66.249.64.141"
    assert_equal true, match.reverse_resolves?
  end

  def test_reverse_doesnt_resolve
    match = Legitbot::BotMatch.new "5.140.70.64"
    assert !match.reverse_resolves?
  end

  def test_valid_class_syntax
    assert Legitbot::Google.valid?("66.249.64.141"), msg: "Valid Googlebot"
    assert Legitbot::Google.fake?("149.210.164.47"), msg: "Fake Googlebot"
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
legitbot-0.3.2 test/botmatch_test.rb
legitbot-0.3.1 test/botmatch_test.rb
legitbot-0.3.0 test/botmatch_test.rb
legitbot-0.2.7 test/botmatch_test.rb
legitbot-0.2.6 test/botmatch_test.rb
legitbot-0.2.4 test/botmatch_test.rb
legitbot-0.2.3 test/botmatch_test.rb
legitbot-0.2.2 test/botmatch_test.rb