Sha256: 44c22060002faff490c4df4534f7930f5ab667be4b309f89500c303c8abcc4b0

Contents?: true

Size: 755 Bytes

Versions: 17

Compression:

Stored size: 755 Bytes

Contents

# frozen_string_literal: true

require_relative 'test_helper'

class YouTest < Minitest::Test
  def test_malicious_ip
    ip = '20.59.41.22'
    match = Legitbot::You.new ip

    refute_predicate match, :valid?
  end

  def test_valid_ip
    ip = '20.59.40.22'
    match = Legitbot::You.new ip

    assert_predicate match, :valid?
  end

  def test_malicious_ua
    bot = Legitbot.bot(
      'Mozilla/5.0 (compatible; YouBot/1.0; +https://about.you.com/youbot/)',
      '20.59.41.22'
    )

    assert bot
    refute_predicate bot, :valid?
  end

  def test_valid_ua
    bot = Legitbot.bot(
      'Mozilla/5.0 (compatible; YouBot/1.0; +https://about.you.com/youbot/)',
      '20.59.40.22'
    )

    assert bot
    assert_predicate bot, :valid?
  end
end

Version data entries

17 entries across 17 versions & 1 rubygems

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