<commit_before><commit_msg>Write specs for Enumerator#size<commit_after>require File.expand_path('../../../spec_helper', __FILE__)

ruby_version_is "2.0" do
  describe "Enumerator#size" do
    it "returns same value if set size is an Integer" do
      Enumerator.new(100) {}.size.should == 100
    end

    it "returns nil if set size is nil" do
      Enumerator.new(nil) {}.size.should be_nil
    end

    it "returns returning value from size.call if set size is a Proc" do
      base_size = 100
      enum = Enumerator.new(lambda { base_size + 1 }) {}
      base_size = 200
      enum.size.should == 201
      base_size = 300
      enum.size.should == 301
    end
  end
end
{'fraction_non_alphanumeric': 0.10502958579881656, 'fraction_numerical': 0.03550295857988166, 'mean_word_length': 2.699453551912568, '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': '3938520', 'n_tokens_mistral': 242, 'n_tokens_neox': 216, 'n_words': 70}