<commit_before>require 'spec_helper'
require 'daun/cli'
require 'fileutils'
require 'tmpdir'

describe 'daun' do

  let(:tmpdir) { Dir.mktmpdir }
  let(:bare_repository) { BareTestRepository.new(File.join(tmpdir, 'bare-repository')) }
  let(:destination) { File.join(tmpdir, 'repository') }
  let(:daun) { DaunCliDriver.new }

  after(:each) do
    FileUtils.rm_rf(tmpdir)
  end

  it "checks out master branch" do
    bare_repository.write_file "foo.txt", "branch/master"

    daun.checkout bare_repository.path, destination

    expect(File).to exist("#{destination}/branches/master")
    expect(File).to exist("#{destination}/branches/master/foo.txt")
    expect(File.read("#{destination}/branches/master/foo.txt")).to match "branch/master"
  end

  it 'updates master branch with the latest change' do
    bare_repository.write_file "foo.txt", "master"
    daun.checkout bare_repository.path, destination

    bare_repository.write_file "foo.txt", "updated"<commit_msg>Use single quote.<commit_after>require 'spec_helper'
require 'daun/cli'
require 'fileutils'
require 'tmpdir'

describe 'daun' do

  let(:tmpdir) { Dir.mktmpdir }
  let(:bare_repository) { BareTestRepository.new(File.join(tmpdir, 'bare-repository')) }
  let(:destination) { File.join(tmpdir, 'repository') }
  let(:daun) { DaunCliDriver.new }

  after(:each) do
    FileUtils.rm_rf(tmpdir)
  end

  it 'checks out master branch' do
    bare_repository.write_file "foo.txt", "branch/master"

    daun.checkout bare_repository.path, destination

    expect(File).to exist("#{destination}/branches/master")
    expect(File).to exist("#{destination}/branches/master/foo.txt")
    expect(File.read("#{destination}/branches/master/foo.txt")).to match "branch/master"
  end

  it 'updates master branch with the latest change' do
    bare_repository.write_file "foo.txt", "master"
    daun.checkout bare_repository.path, destination

    bare_repository.write_file "foo.txt", "updated"
{'fraction_non_alphanumeric': 0.13794871794871794, 'fraction_numerical': 0.0, 'mean_word_length': 4.806547619047619, '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': '2847923', 'n_tokens_mistral': 657, 'n_tokens_neox': 632, 'n_words': 127}