Sha256: 835768ea3c86789ac3cffcd0a3697e86fb4ef5b4a8595c0b90841b5f4342c5f3

Contents?: true

Size: 667 Bytes

Versions: 1

Compression:

Stored size: 667 Bytes

Contents

# frozen_string_literal: true

require_relative 'test_helper'

class TwitterTest < Minitest::Test
  def test_malicious_ip
    ip = '149.210.164.47'
    match = Legitbot::Twitter.new ip
    refute_predicate match, :valid?
  end

  def test_valid_ip
    ip = '199.16.156.125'
    match = Legitbot::Twitter.new ip
    assert_predicate match, :valid?
  end

  def test_malicious_ua
    bot = Legitbot.bot(
      'Twitterbot/1.0',
      '149.210.164.47'
    )
    assert bot
    refute_predicate bot, :valid?
  end

  def test_valid_ua
    bot = Legitbot.bot(
      'Twitterbot/1.0',
      '199.16.156.125'
    )
    assert bot
    assert_predicate bot, :valid?
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
legitbot-1.7.2 test/twitter_test.rb