<commit_before>describe Metacrunch::Db::Reader do

  DB_URL = "sqlite://#{File.join(asset_dir, "dummy.sqlite")}"

  describe "#each" do
    subject { Metacrunch::Db::Reader.new(DB_URL, "select * from users") }

    context "when called without a block" do
      it "returns an enumerator" do
        expect(subject.each).to be_a(Enumerator)
      end
    end

    context "when called with a block" do
      it "calls the block for each row" do
        users = []
        subject.each do |row|
          users << row
        end

        expect(users.count).to be(100)
      end
    end
  end

end<commit_msg>Make sure to use the right connection string in case of JRuby.<commit_after>describe Metacrunch::Db::Reader do

  DB_PROTOCOL = defined?(JRUBY_VERSION) ? "jdbc:sqlite" : "sqlite"
  DB_URL = "#{DB_PROTOCOL}://#{File.join(asset_dir, "dummy.sqlite")}"

  describe "#each" do
    subject { Metacrunch::Db::Reader.new(DB_URL, "select * from users") }

    context "when called without a block" do
      it "returns an enumerator" do
        expect(subject.each).to be_a(Enumerator)
      end
    end

    context "when called with a block" do
      it "calls the block for each row" do
        users = []
        subject.each do |row|
          users << row
        end

        expect(users.count).to be(100)
      end
    end
  end

end
{'fraction_non_alphanumeric': 0.11102831594634874, 'fraction_numerical': 0.004470938897168405, 'mean_word_length': 2.5157068062827226, 'pattern_counts': {'":': 0, '<': 7, '<?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': '6592662', 'n_tokens_mistral': 444, 'n_tokens_neox': 432, 'n_words': 130}