<commit_before>require 'rubygems'
require 'spork'

Spork.prefork do
  # This file is copied to spec/ when you run 'rails generate rspec:install'
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'

  # Requires supporting ruby files with custom matchers and macros, etc,
  # in spec/support/ and its subdirectories.
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

  RSpec.configure do |config|
    # == Mock Framework
    #
    # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
    #
    # config.mock_with :mocha
    # config.mock_with :flexmock
    # config.mock_with :rr
    config.mock_with :rspec

    # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
    # config.fixture_path = "#{::Rails.root}/spec/fixtures"

    # If you're not using ActiveRecord, or you'd prefer not to run each of your
    # examples within a transaction, remove the following line or assign false
    # instead of true.
    config.use_transactional_fixtures = false

    # clean up after ourselves.  kill all test records
    config.after(:each) do 
      models=[]
      path="#{::Rails.root.to_s}/app/models"
      Find.find(path) do |p|
        if FileTest.directory?(p) and p!=path
          Find.prune # dont recurse into directories
          next
        end
        if p =~ /.rb$/
           models << File.basename(p,".*").camelize.constantize
        end
      end
      models.each do |m|
        m.delete_all unless m.to_s == "Ability"
      end
    end  
    
    ### Part of a Spork hack. See http://bit.ly/arY19y
    # Emulate initializer set_clear_dependencies_hook in 
    # railties/lib/rails/application/bootstrap.rb
    ActiveSupport::Dependencies.clear
    
  end # of RSpec.configure
end # of Spork.prefork

Spork.each_run do
  # This code will be run each time you run your specs.
  Factory.factories.clear
  Dir[Rails.root.join("spec/factories/**/*.rb")].each{|f| load f}
end

# --- Instructions ---
# - Sort through your spec_helper file. Place as much environment loading 
#   code that you don't normally modify during development in the 
#   Spork.prefork block.
# - Place the rest under Spork.each_run block
# - Any code that is left outside of the blocks will be ran during preforking
#   and during each_run!
# - These instructions should self-destruct in 10 seconds.  If they don't,
#   feel free to delete them.
<commit_msg>ignoring models without tables created in db tear-down. also ignoring models without delete_all method<commit_after>require 'rubygems'
require 'spork'

Spork.prefork do
  # This file is copied to spec/ when you run 'rails generate rspec:install'
  ENV["RAILS_ENV"] ||= 'test'
  require File.expand_path("../../config/environment", __FILE__)
  require 'rspec/rails'

  # Requires supporting ruby files with custom matchers and macros, etc,
  # in spec/support/ and its subdirectories.
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

  RSpec.configure do |config|
    # == Mock Framework
    #
    # If you prefer to use mocha, flexmock or RR, uncomment the appropriate line:
    #
    # config.mock_with :mocha
    # config.mock_with :flexmock
    # config.mock_with :rr
    config.mock_with :rspec

    # Remove this line if you're not using ActiveRecord or ActiveRecord fixtures
    # config.fixture_path = "#{::Rails.root}/spec/fixtures"

    # If you're not using ActiveRecord, or you'd prefer not to run each of your
    # examples within a transaction, remove the following line or assign false
    # instead of true.
    config.use_transactional_fixtures = false

    # clean up after ourselves.  kill all test records
    config.after(:each) do 
      models=[]
      path="#{::Rails.root.to_s}/app/models"
      Find.find(path) do |p|
        if FileTest.directory?(p) and p!=path
          Find.prune # dont recurse into directories
          next
        end
        if p =~ /.rb$/
           models << File.basename(p,".*").camelize.constantize
        end
      end
      models.each do |m|
        m.delete_all if m.respond_to?('delete_all') && m.respond_to?('table_exists?') && m.table_exists?
      end
    end  
    
    ### Part of a Spork hack. See http://bit.ly/arY19y
    # Emulate initializer set_clear_dependencies_hook in 
    # railties/lib/rails/application/bootstrap.rb
    ActiveSupport::Dependencies.clear
    
  end # of RSpec.configure
end # of Spork.prefork

Spork.each_run do
  # This code will be run each time you run your specs.
  Factory.factories.clear
  Dir[Rails.root.join("spec/factories/**/*.rb")].each{|f| load f}
end

# --- Instructions ---
# - Sort through your spec_helper file. Place as much environment loading 
#   code that you don't normally modify during development in the 
#   Spork.prefork block.
# - Place the rest under Spork.each_run block
# - Any code that is left outside of the blocks will be ran during preforking
#   and during each_run!
# - These instructions should self-destruct in 10 seconds.  If they don't,
#   feel free to delete them.

{'fraction_non_alphanumeric': 0.1018409714061888, 'fraction_numerical': 0.0015667841754798276, 'mean_word_length': 2.9345146379044684, 'pattern_counts': {'":': 0, '<': 7, '<?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': '309591', 'n_tokens_mistral': 1611, 'n_tokens_neox': 1550, 'n_words': 520}