<commit_before>require  "#{File.dirname(__FILE__)}/../lib/rscaffold"
include FileUtils


describe RScaffold do

  before(:all) do
    FileUtils.rm_rf 'test_output'
    FileUtils.mkdir_p 'test_output'
    Dir.chdir 'test_output'
  end

  it 'camelcases a snake_case string' do
    RScaffold.camel_case('foo_bar_baz').should eq 'FooBarBaz'
  end

  describe RScaffold::Project do

    before do
      @output_bin = "#!/usr/bin/env ruby\n\nrequire 'my_project'\n"
      @p = RScaffold::Project.new 'my_project'
    end
    
    it 'has a name' do
      @p.name.should eq 'my_project'
    end

    it 'has a CamelName' do
      @p.camel.should eq 'MyProject'
    end

    it 'can have the remote reset' do
      new_remote = 'https://some/secure/server/my_project'
      @p.remote = new_remote
      @p.remote.should eq new_remote 
    end

    it 'renders templates' do
      @p.rendered('bin').should eq @output_bin
    end

    it 'makes destination files' do
      @p.write('bin')
      File.read('bin/my_project').should eq @output_bin
    end

    it 'makes all destination files' do
      @p.write_all
    end<commit_msg>make write_all test actually test something<commit_after>require  "#{File.dirname(__FILE__)}/../lib/rscaffold"
require 'find'
include FileUtils
include FileTest
include Find

def output_files
  Find.find('.').select{|f| FileTest.file?(f) }
end


describe RScaffold do

  before(:all) do
    FileUtils.rm_rf 'test_output'
    FileUtils.mkdir_p 'test_output'
    Dir.chdir 'test_output'
  end

  it 'camelcases a snake_case string' do
    RScaffold.camel_case('foo_bar_baz').should eq 'FooBarBaz'
  end

  describe RScaffold::Project do

    before do
      @output_bin = "#!/usr/bin/env ruby\n\nrequire 'my_project'\n"
      @p = RScaffold::Project.new 'my_project'
    end
    
    it 'has a name' do
      @p.name.should eq 'my_project'
    end

    it 'has a CamelName' do
      @p.camel.should eq 'MyProject'
    end

    it 'can have the remote reset' do
      new_remote = 'https://some/secure/server/my_project'
      @p.remote = new_remote
      @p.remote.should eq new_remote 
    end

    it 'renders templates' do
      @p.rendered('bin').should eq @output_bin
    end

    it 'makes destination files' do
      @p.write('bin')
      File.read('bin/my_project').should eq @output_bin
    end

    it 'makes all destination files' do
      @p.write_all
      @p.location.length.should eq output_files.length
    end
{'fraction_non_alphanumeric': 0.10866013071895425, 'fraction_numerical': 0.0, 'mean_word_length': 2.791021671826625, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 2, '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': '3182277', 'n_tokens_mistral': 885, 'n_tokens_neox': 846, 'n_words': 214}