<commit_before>require 'spec_helper'

describe BitCounter do

  context 'a binary file' do

    subject(:counter) do
      BitCounter.new(with_fullpath('assets/file.jpg'))
    end

    it "returns a binary representation of the file's body as a string" do
      expect(counter.as_binary_string.chars.uniq).to eq(%w(1 0))
    end
  end
end<commit_msg>The binary representation as a string works for a text file as well.<commit_after>require 'spec_helper'

describe BitCounter do

  context 'a binary file' do

    subject(:counter) do
      BitCounter.new(with_fullpath('assets/file.jpg'))
    end

    it "returns a binary representation of the file's body as a string" do
      expect(counter.as_binary_string.chars.uniq.sort).to eq(%w(0 1))
    end
  end

  context 'a text file' do

    subject(:counter) do
      BitCounter.new(with_fullpath('assets/file.txt'))
    end

    it "returns a binary representation of the file's body as a string" do
      expect(counter.as_binary_string.chars.uniq.sort).to eq(%w(0 1))
    end
  end
end
{'fraction_non_alphanumeric': 0.0935390549662488, 'fraction_numerical': 0.0057859209257473485, 'mean_word_length': 3.4170212765957446, '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': '5685816', 'n_tokens_mistral': 336, 'n_tokens_neox': 318, 'n_words': 104}