Sha256: f5e48754bbc003da0472f1862c7c858cd1e8aa1e5799894cf7bd3875e2b33ab3
Contents?: true
Size: 884 Bytes
Versions: 9
Compression:
Stored size: 884 Bytes
Contents
# frozen_string_literal: true require_relative 'test_helper' class AlexaTest < Minitest::Test include Minitest::Hooks include DnsServerMock def test_malicious_ip ip = '149.210.164.47' match = Legitbot::Alexa.new ip refute_predicate match, :valid? end def test_valid_ip ip = '52.86.176.3' match = Legitbot::Alexa.new ip assert_predicate match, :valid? end def test_malicious_ua bot = Legitbot.bot( 'Mozilla/5.0 (compatible; Alexabot/1.0; +http://www.alexa.com/help/certifyscan; certifyscan@alexa.com)', '149.210.164.47' ) assert bot refute_predicate bot, :valid? end def test_valid_ua bot = Legitbot.bot( 'Mozilla/5.0 (compatible; Alexabot/1.0; +http://www.alexa.com/help/certifyscan; certifyscan@alexa.com)', '52.86.176.3' ) assert bot assert_predicate bot, :valid? end end
Version data entries
9 entries across 9 versions & 1 rubygems