<commit_before>require 'spec_helper'

describe GeneralStore do
  subject { GeneralStore }

  after :each do
    File.delete(project_path + "/config.yml") if File.exist?(project_path + "/config.yml")
  end

  describe '.create' do
    it 'yields to ostruct' do
      expect {|probe| subject.create(project_path, &probe) }
        .to yield_control
    end
  end

  describe '.read' do
    it 'reads the attributes' do
      subject.create project_path do |gs|
        gs.test = 'test'
      end

      result = subject.read project_path
      expect(result.test).to eq('test')
    end
  end

  describe 'private methods' do
    let(:dir) { '~/.test-dir' }

    describe 'class methods' do
      it '.new' do<commit_msg>test that config file is not world readable or writable<commit_after>require 'spec_helper'

describe GeneralStore do
  subject { GeneralStore }

  before :each do
    subject.create project_path do |gs|
      gs.test = 'test'
    end
  end

  after :each do
    File.delete(project_path + "/config.yml") if File.exist?(project_path + "/config.yml")
  end

  describe '.create' do
    it 'yields to ostruct' do
      expect {|probe| subject.create(project_path, &probe) }
        .to yield_control
    end
  end

  describe '.read' do
    it 'reads the attributes' do
      expect(subject.read(project_path).test)
        .to eq('test')
    end
  end

  describe 'world access' do
    it 'is not world readable' do
      file = subject.config_file project_path
      expect(File.world_writable? file).to be_nil
    end

    it 'is not world writable' do
      file = subject.config_file project_path
      expect(File.world_readable? file).to be_nil
    end
  end

  describe 'private methods' do
    let(:dir) { '~/.test-dir' }

    describe 'class methods' do
      it '.new' do
{'fraction_non_alphanumeric': 0.10127991096271564, 'fraction_numerical': 0.0, 'mean_word_length': 2.669387755102041, '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': '3734933', 'n_tokens_mistral': 587, 'n_tokens_neox': 559, 'n_words': 175}