test/petalbot_test.rb in legitbot-1.5.1 vs test/petalbot_test.rb in legitbot-1.6.0

- old
+ new

@@ -1,38 +1,43 @@ # frozen_string_literal: true require 'minitest/autorun' +require 'minitest/hooks/test' +require 'lib/dns_server_mock' require 'legitbot' class PetalbotTest < Minitest::Test + include Minitest::Hooks + include DnsServerMock + def test_malicious_ip ip = '149.210.164.47' match = Legitbot::Petalbot.new ip - assert !match.valid?, msg: "#{ip} is not a real Petalbot IP" + refute match.valid? end def test_valid_ip - ip = '114.119.128.10' + ip = '114.119.134.10' match = Legitbot::Petalbot.new ip - assert match.valid?, msg: "#{ip} is a valid Petalbot IP" + assert match.valid? end def test_malicious_ua bot = Legitbot.bot( 'Mozilla/5.0 (compatible;PetalBot; +https://aspiegel.com/petalbot)', '149.210.164.47' ) - assert bot, msg: 'Petalbot detected from User-Agent' - assert !bot.valid?, msg: 'Not a valid Petalbot' + assert bot + refute bot.valid? end def test_valid_ua bot = Legitbot.bot( 'Mozilla/5.0 (compatible;PetalBot; +https://aspiegel.com/petalbot)', - '114.119.128.10' + '114.119.134.10' ) - assert bot, msg: 'Petalbot detected from User-Agent' - assert bot.valid?, msg: 'Valid Petalbot' + assert bot + assert bot.valid? end def test_valid_name bot = Legitbot.bot( 'Mozilla/5.0 (compatible;PetalBot; +https://aspiegel.com/petalbot)',