<commit_before>require File.dirname(__FILE__) + '/spec_helper'

describe Snip::Repo do

  before do
    @repo = Snip::Repo.new(File.dirname(__FILE__) + '/../examples/snips')
  end

  it 'should load all Snips from a directory' do
    Snip::Repo.new('/some/crazy/dir').snips.should be_empty

    @repo.all_snips.length.should == 8 # retuns old versions, too
    @repo.snips.length.should == 7 # only returns CURRENT snips
    @repo.all_snips.map(&:name).sort.should == %w( blah-ti-da_something erb haml haml_something sass sass sass_something test )
    @repo.snips.map(&:name).sort.should == %w( blah-ti-da_something erb haml haml_something sass sass_something test )
  end  

  it 'should return a single, first found snip on #snip' do
    @repo.snip(/sass/).should be_a_kind_of(Snip)
    @repo.snip(/sass/).name.should == 'sass'
    @repo.snip(:sass).name.should == 'sass'
    lambda { @repo.snip(:sass, :erb) }.should raise_error
  end

  it 'should return a many, first found snips on #snips' do
    @repo.snips(/_something/).length.should == 3
    @repo.snips('sass', /sass/, :sass).length.should == 2
    @repo.snips(:sass, /_something/, :erb).length.should == 5
  end

end<commit_msg>got some pending specs for REMOTE repo ... use MockRequests to SnipServer as remote<commit_after>require File.dirname(__FILE__) + '/spec_helper'

describe Snip::Repo do

  before do
    @repo = Snip::Repo.new(File.dirname(__FILE__) + '/../examples/snips')
  end

  it 'should load all Snips from a directory' do
    Snip::Repo.new('/some/crazy/dir').snips.should be_empty

    @repo.all_snips.length.should == 8 # retuns old versions, too
    @repo.snips.length.should == 7 # only returns CURRENT snips
    @repo.all_snips.map(&:name).sort.should == %w( blah-ti-da_something erb haml haml_something sass sass sass_something test )
    @repo.snips.map(&:name).sort.should == %w( blah-ti-da_something erb haml haml_something sass sass_something test )
  end  
  it 'should load all Snips from a directory (remote)'

  it 'should return a single, first found snip on #snip' do
    @repo.snip(/sass/).should be_a_kind_of(Snip)
    @repo.snip(/sass/).name.should == 'sass'
    @repo.snip(:sass).name.should == 'sass'
    lambda { @repo.snip(:sass, :erb) }.should raise_error
  end
  it 'should return a single, first found snip on #snip (remote)'

  it 'should return a many, first found snips on #snips' do
    @repo.snips(/_something/).length.should == 3
    @repo.snips('sass', /sass/, :sass).length.should == 2
    @repo.snips(:sass, /_something/, :erb).length.should == 5
  end
  it 'should return a many, first found snips on #snips (remote)'

  it 'should be able to read a file'
  it 'should be able to read a file (remote)'

  it 'should list current snips'
  it 'should list current snips (remote)'

  it 'should search current snips'
  it 'should search current snips (remote)'

end
{'fraction_non_alphanumeric': 0.13789510246613407, 'fraction_numerical': 0.0034734282737061478, 'mean_word_length': 3.6451612903225805, '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': '5171051', 'n_tokens_mistral': 1045, 'n_tokens_neox': 1015, 'n_words': 283}