Sha256: 556db79c0d34aad8763471f18ba805ebfa4ddd9c6d2d8f26168a1ff8f716abf3

Contents?: true

Size: 662 Bytes

Versions: 10

Compression:

Stored size: 662 Bytes

Contents

require 'minitest/autorun'
require 'legitbot'

class AppleAsGoogleTest < Minitest::Test
  def test_valid_ip
    ip = "17.58.98.60"
    match = Legitbot::Apple_as_Google.new(ip)
    assert match.valid?, msg: "#{ip} is a valid Applebot IP"
  end

  def test_invalid_ip
    ip = "127.0.0.1"
    match = Legitbot::Apple_as_Google.new(ip)
    assert match.fake?, msg: "#{ip} is a fake Applebot IP"
  end

  def test_user_agent
    bot = Legitbot.bot("Mozilla/5.0 (compatible; Googlebot/2.1; +http://www.google.com/bot.html)", "17.58.98.60")
    assert_equal :apple_as_google, bot.detected_as
    assert bot.valid?, msg: "A valid Applebot User-agent and IP"
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

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