test/pinterest_test.rb in legitbot-1.5.1 vs test/pinterest_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 PinterestTest < Minitest::Test
+ include Minitest::Hooks
+ include DnsServerMock
+
def test_malicious_ip
ip = '149.210.164.47'
match = Legitbot::Pinterest.new ip
- assert !match.valid?, msg: "#{ip} is not a real Pinterest IP"
+ refute match.valid?
end
def test_valid_ip
ip = '54.236.1.11'
match = Legitbot::Pinterest.new ip
- assert match.valid?, msg: "#{ip} is a valid Pinterest IP"
+ assert match.valid?
end
def test_malicious_ua
bot = Legitbot.bot(
'Mozilla/5.0 (compatible; Pinterestbot/1.0; +https://www.pinterest.com/bot.html)',
'149.210.164.47'
)
- assert bot, msg: 'Pinterest detected from User-Agent'
- assert !bot.valid?, msg: 'Not a valid Pinterest'
+ assert bot
+ refute bot.valid?
end
def test_valid_ua
bot = Legitbot.bot(
'Mozilla/5.0 (compatible; Pinterestbot/1.0; +https://www.pinterest.com/bot.html)',
'54.236.1.11'
)
- assert bot, msg: 'Pinterest detected from User-Agent'
- assert bot.valid?, msg: 'Valid Pinterest'
+ assert bot
+ assert bot.valid?
end
# rubocop:disable Layout/LineLength
def test_android_not_bot
bot = Legitbot.bot(