<commit_before># frozen_string_literal: true

require "test_helper"

class RequestGeolocatorTest < ActionView::TestCase
  it "suggests location from ip address" do
    suggestion = RequestGeolocator.new("192.168.127.12").suggest

    assert_equal "Alameda, California, Estados Unidos",
                 suggestion.fullname
  end

  it "suggests properly translated locations" do
    I18n.with_locale(:en) do
      suggestion = RequestGeolocator.new("192.168.127.12").suggest
      assert_equal "Mountain View, California, United States", suggestion.fullname
    end
  end

  it "does not suggest a location unless it's city-specific" do
    assert_nil \
      RequestGeolocator.new(ip_from_brazil_but_not_a_specific_city).suggest
  end

  private

  def ip_from_brazil_but_not_a_specific_city
    "192.168.3.11"
  end
end
<commit_msg>Catch up with recent changes in MaxMind's DB<commit_after># frozen_string_literal: true

require "test_helper"

class RequestGeolocatorTest < ActionView::TestCase
  it "suggests location from ip address" do
    suggestion = RequestGeolocator.new("192.168.127.12").suggest

    assert_equal "Alameda, California, Estados Unidos",
                 suggestion.fullname
  end

  it "suggests properly translated locations" do
    I18n.with_locale(:en) do
      suggestion = RequestGeolocator.new("192.168.127.12").suggest
      assert_equal "Alameda, California, United States", suggestion.fullname
    end
  end

  it "does not suggest a location unless it's city-specific" do
    assert_nil \
      RequestGeolocator.new(ip_from_brazil_but_not_a_specific_city).suggest
  end

  private

  def ip_from_brazil_but_not_a_specific_city
    "192.168.3.11"
  end
end

{'fraction_non_alphanumeric': 0.07619610159480213, 'fraction_numerical': 0.03898405197873597, 'mean_word_length': 3.881844380403458, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 6, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1871066', 'n_tokens_mistral': 595, 'n_tokens_neox': 538, 'n_words': 130}