<commit_before>require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/common', __FILE__)
require File.expand_path('../shared/closed', __FILE__)

describe "Dir#rewind" do
  before :all do
    DirSpecs.create_mock_dirs
  end

  after :all do
    DirSpecs.delete_mock_dirs
  end

  before :each do
    @dir = Dir.open DirSpecs.mock_dir
  end

  after :each do
    @dir.close
  end

  it "resets the next read to start from the first entry" do
    @dir.pos.should == 0
    a = @dir.read
    b = @dir.read
    a.should_not == b
    @dir.pos.should > 0
    @dir.rewind
    @dir.pos.should == 0
    c = @dir.read<commit_msg>Do not make assumptions on the value of Dir#pos<commit_after>require File.expand_path('../../../spec_helper', __FILE__)
require File.expand_path('../fixtures/common', __FILE__)
require File.expand_path('../shared/closed', __FILE__)

describe "Dir#rewind" do
  before :all do
    DirSpecs.create_mock_dirs
  end

  after :all do
    DirSpecs.delete_mock_dirs
  end

  before :each do
    @dir = Dir.open DirSpecs.mock_dir
  end

  after :each do
    @dir.close
  end

  it "resets the next read to start from the first entry" do
    a = @dir.read
    b = @dir.read
    a.should_not == b
    @dir.rewind
    c = @dir.read
{'fraction_non_alphanumeric': 0.11971830985915492, 'fraction_numerical': 0.002347417840375587, 'mean_word_length': 2.852409638554217, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, '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': '7022267', 'n_tokens_mistral': 464, 'n_tokens_neox': 450, 'n_words': 123}