Sha256: 25cbad0d44242894bbeae5f8a8fe3c598c0e1f993229babf43bdcf3b115ae469

Contents?: true

Size: 801 Bytes

Versions: 16

Compression:

Stored size: 801 Bytes

Contents

# frozen_string_literal: true

require_relative 'test_helper'

class AppleTest < Minitest::Test
  include Minitest::Hooks
  include DnsServerMock

  def test_valid_ip
    ip = '17.58.98.60'
    match = Legitbot::Apple.new(ip)

    assert_predicate match, :valid?
  end

  def test_invalid_ip
    ip = '127.0.0.1'
    match = Legitbot::Apple.new(ip)

    assert_predicate match, :fake?
  end

  # rubocop:disable Layout/LineLength
  def test_user_agent
    bot = Legitbot.bot(
      'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5 (Applebot/0.1; +http://www.apple.com/go/applebot)',
      '17.58.98.60'
    )

    assert_equal :apple, bot.detected_as
    assert_predicate bot, :valid?
  end
  # rubocop:enable Layout/LineLength
end

Version data entries

16 entries across 16 versions & 1 rubygems

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