<commit_before># 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'
require 'email_spec'

# 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|
  config.mock_with :mocha

  config.include EmailSpec::Helpers
  config.include EmailSpec::Matchers
  config.include CartoDB::Factories
  
  config.before(:suite) do
    CartoDB::RedisTest.up
  end  

  config.before(:each) do
    $threshold.flushdb
    # $queries_log.flushdb
    $tables_metadata.flushdb
    $api_credentials.flushdb
    Rails::Sequel.connection.tables.each{ |t| next if t == :schema_migrations; Rails::Sequel.connection[t].truncate }
  end

  config.after(:each) do
    $pool.close_connections!
    Rails::Sequel.connection[
      "SELECT datname FROM pg_database WHERE datistemplate IS FALSE AND datallowconn IS TRUE AND datname like 'cartodb_test_user_%'"
    ].map(:datname).each { |user_database_name| Rails::Sequel.connection.run("drop database #{user_database_name}") }
    Rails::Sequel.connection[
      "SELECT u.usename FROM pg_catalog.pg_user u"
    ].map{ |r| r.values.first }.each { |username| Rails::Sequel.connection.run("drop user #{username}") if username =~ /^test_cartodb_user_/ }
  end
  
  config.after(:suite) do
    CartoDB::RedisTest.down
  end

end<commit_msg>users metadata in spec helper<commit_after># 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'
require 'email_spec'

# 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|
  config.mock_with :mocha

  config.include EmailSpec::Helpers
  config.include EmailSpec::Matchers
  config.include CartoDB::Factories
  
  config.before(:suite) do
    CartoDB::RedisTest.up
  end  

  config.before(:each) do
    $threshold.flushdb
    # $queries_log.flushdb
    $tables_metadata.flushdb
    $api_credentials.flushdb
    $users_metadata.flushdb
    
    Rails::Sequel.connection.tables.each{ |t| next if t == :schema_migrations; Rails::Sequel.connection[t].truncate }
  end

  config.after(:each) do
    $pool.close_connections!
    Rails::Sequel.connection[
      "SELECT datname FROM pg_database WHERE datistemplate IS FALSE AND datallowconn IS TRUE AND datname like 'cartodb_test_user_%'"
    ].map(:datname).each { |user_database_name| Rails::Sequel.connection.run("drop database #{user_database_name}") }
    Rails::Sequel.connection[
      "SELECT u.usename FROM pg_catalog.pg_user u"
    ].map{ |r| r.values.first }.each { |username| Rails::Sequel.connection.run("drop user #{username}") if username =~ /^test_cartodb_user_/ }
  end
  
  config.after(:suite) do
    CartoDB::RedisTest.down
  end

end
{'fraction_non_alphanumeric': 0.12608, 'fraction_numerical': 0.0, 'mean_word_length': 4.371134020618556, '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': '1958476', 'n_tokens_mistral': 1048, 'n_tokens_neox': 1027, 'n_words': 240}