Sha256: 6310bda6fe5730238845d17af9f572a247d322c0da48ab2dd56bc138f48b7f46
Contents?: true
Size: 821 Bytes
Versions: 3
Compression:
Stored size: 821 Bytes
Contents
# frozen_string_literal: true require 'minitest/autorun' require 'legitbot' class OracleTest < Minitest::Test def test_malicious_ip ip = '149.210.164.47' match = Legitbot::Oracle.new ip refute_predicate match, :valid? end def test_valid_ip ip = '148.64.56.64' match = Legitbot::Oracle.new ip assert_predicate match, :valid? end def test_malicious_ua bot = Legitbot.bot( 'Mozilla/5.0 (compatible; GrapeshotCrawler/2.0; +http://www.grapeshot.co.uk/crawler.php)', '149.210.164.47' ) assert bot refute_predicate bot, :valid? end def test_valid_ua bot = Legitbot.bot( 'Mozilla/5.0 (compatible; GrapeshotCrawler/2.0; +http://www.grapeshot.co.uk/crawler.php)', '148.64.56.64' ) assert bot assert_predicate bot, :valid? end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
legitbot-1.7.1 | test/oracle_test.rb |
legitbot-1.7.0 | test/oracle_test.rb |
legitbot-1.6.1 | test/oracle_test.rb |