Sha256: d8ea294ade4e74c3d6ec194e5cfea4f952c5de21928f4799096a4857cc1bc727

Contents?: true

Size: 767 Bytes

Versions: 15

Compression:

Stored size: 767 Bytes

Contents

# frozen_string_literal: true

require_relative 'test_helper'

class IasTest < Minitest::Test
  def test_malicious_ip
    ip = '149.210.164.47'
    match = Legitbot::Ias.new ip

    refute_predicate match, :valid?
  end

  def test_valid_ip
    ip = '18.214.43.70'
    match = Legitbot::Ias.new ip

    assert_predicate match, :valid?
  end

  def test_malicious_ua
    bot = Legitbot.bot(
      'IAS Crawler (ias_crawler; http://integralads.com/site-indexing-policy/)',
      '18.214.43.72'
    )

    assert bot
    refute_predicate bot, :valid?
  end

  def test_valid_ua
    bot = Legitbot.bot(
      'IAS Crawler (ias_crawler; http://integralads.com/site-indexing-policy/)',
      '18.214.43.70'
    )

    assert bot
    assert_predicate bot, :valid?
  end
end

Version data entries

15 entries across 15 versions & 1 rubygems

Version Path
legitbot-1.11.2 test/ias_test.rb
legitbot-1.11.1 test/ias_test.rb
legitbot-1.11.0 test/ias_test.rb
legitbot-1.10.6 test/ias_test.rb
legitbot-1.10.5 test/ias_test.rb
legitbot-1.10.4 test/ias_test.rb
legitbot-1.10.3 test/ias_test.rb
legitbot-1.10.1 test/ias_test.rb
legitbot-1.10.0 test/ias_test.rb
legitbot-1.9.4 test/ias_test.rb
legitbot-1.9.3 test/ias_test.rb
legitbot-1.9.2 test/ias_test.rb
legitbot-1.9.1 test/ias_test.rb
legitbot-1.9.0 test/ias_test.rb
legitbot-1.8.0 test/ias_test.rb