<commit_before>RSpec.shared_examples 'a manager' do
  it 'loads proxy list on initialization by default' do
    manager = ProxyFetcher::Manager.new
    expect(manager.proxies).not_to be_empty
  end

  it "doesn't load proxy list on initialization if `refresh` argument was set to false" do
    manager = ProxyFetcher::Manager.new(refresh: false)
    expect(manager.proxies).to be_empty
  end

  it 'returns valid Proxy objects' do
    manager = ProxyFetcher::Manager.new
    expect(manager.proxies).to all(be_a(ProxyFetcher::Proxy))

    manager.proxies.each do |proxy|
      expect(proxy.addr).to match(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/i)
      expect(proxy.port).to be_instance_of(Integer)
      expect(proxy.type).not_to be_empty
      expect(proxy.country).not_to be_empty
      expect(proxy.anonymity).not_to be_empty

      expect(proxy.response_time).to be_nil.or(be_instance_of(Integer))
    end
  end

  it 'returns raw proxies (HOST:PORT)' do
    manager = ProxyFetcher::Manager.new
    expect(manager.raw_proxies).to all(be_a(String))
  end

  it 'cleanup proxy list from dead servers' do
    allow_any_instance_of(ProxyFetcher::Proxy).to receive(:connectable?).and_return(false)

    manager = ProxyFetcher::Manager.new

    expect { manager.cleanup! }.to change { manager.proxies }.to([])
  end

  it "doesn't pollute the output with array of proxies" do
    manager = ProxyFetcher::Manager.new(refresh: false)
    expect(manager.inspect).to eq(manager.to_s)
  end

  it 'returns first proxy' do
    manager = ProxyFetcher::Manager.new

    first_proxy = manager.proxies.first

    expect(manager.get).to eq(first_proxy)
    expect(manager.proxies.first).not_to eq(first_proxy)
  end
<commit_msg>Fix specs for old rubies<commit_after>RSpec.shared_examples 'a manager' do
  it 'loads proxy list on initialization by default' do
    manager = ProxyFetcher::Manager.new
    expect(manager.proxies).not_to be_empty
  end

  it "doesn't load proxy list on initialization if `refresh` argument was set to false" do
    manager = ProxyFetcher::Manager.new(refresh: false)
    expect(manager.proxies).to be_empty
  end

  it 'returns valid Proxy objects' do
    manager = ProxyFetcher::Manager.new
    expect(manager.proxies).to all(be_a(ProxyFetcher::Proxy))

    manager.proxies.each do |proxy|
      expect(proxy.addr).to match(/\b\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}\b/i)
      expect(proxy.port).to be_a_kind_of(Numeric)
      expect(proxy.type).not_to be_empty
      expect(proxy.country).not_to be_empty
      expect(proxy.anonymity).not_to be_empty

      expect(proxy.response_time).to be_nil.or(be_a_kind_of(Numeric))
    end
  end

  it 'returns raw proxies (HOST:PORT)' do
    manager = ProxyFetcher::Manager.new
    expect(manager.raw_proxies).to all(be_a(String))
  end

  it 'cleanup proxy list from dead servers' do
    allow_any_instance_of(ProxyFetcher::Proxy).to receive(:connectable?).and_return(false)

    manager = ProxyFetcher::Manager.new

    expect { manager.cleanup! }.to change { manager.proxies }.to([])
  end

  it "doesn't pollute the output with array of proxies" do
    manager = ProxyFetcher::Manager.new(refresh: false)
    expect(manager.inspect).to eq(manager.to_s)
  end

  it 'returns first proxy' do
    manager = ProxyFetcher::Manager.new

    first_proxy = manager.proxies.first

    expect(manager.get).to eq(first_proxy)
    expect(manager.proxies.first).not_to eq(first_proxy)
  end

{'fraction_non_alphanumeric': 0.11514975283512649, 'fraction_numerical': 0.004652515266065717, 'mean_word_length': 3.8933143669985775, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, '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': '3081981', 'n_tokens_mistral': 1197, 'n_tokens_neox': 1175, 'n_words': 256}