Sha256: 98df91e88e4b1a79cb5fad1490e74c210a0ce314564e6f5d4fd7698f2aea984a

Contents?: true

Size: 638 Bytes

Versions: 4

Compression:

Stored size: 638 Bytes

Contents

require 'minitest/autorun'
require 'legitbot'

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

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

  def test_user_agent
    bot = Legitbot.bot("facebookexternalhit/1.1 (+http://www.facebook.com/externalhit_uatext.php)", "31.13.76.56")
    assert_equal :facebook, bot.detected_as
    assert bot.valid?, msg: "A valid Facebook User-agent and IP"
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
legitbot-0.2.3 test/facebook_test.rb
legitbot-0.2.2 test/facebook_test.rb
legitbot-0.2.1 test/facebook_test.rb
legitbot-0.2.0 test/facebook_test.rb