Sha256: f0fbd4197d70b6347506a5c79811ecb2d75c01b5111bde48476c64da2357293f

Contents?: true

Size: 671 Bytes

Versions: 20

Compression:

Stored size: 671 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

20 entries across 20 versions & 1 rubygems

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