<commit_before>require 'rubygems'
require 'rack/test'
require File.expand_path("../../config/environment", __FILE__)

env = 'test'
ENV["RACK_ENV"] ||= env

config = JSON.parse(File.read("./config.#{env}.json"), symbolize_names: true)

# Expects the user who executes `rspec` to also have postgres login rights - without password
system "psql postgres -c 'DROP DATABASE IF EXISTS \"#{config[:db][:database]}\"'"
system "createdb \"#{config[:db][:database]}\""
system "psql \"#{config[:db][:database]}\" -c 'CREATE EXTENSION hstore'"
system "psql \"#{config[:db][:database]}\" -c 'CREATE EXTENSION postgis'"
system "psql \"#{config[:db][:database]}\" -c 'CREATE EXTENSION pg_trgm'"

# Run migrations - initialize tables, constants and functions
system "cd db && ruby run_migrations.rb #{env}"

RSpec.configure do |c|
  c.mock_with :rspec
  c.expect_with :rspec
end
<commit_msg>hardcode 'test'; we don't want to delete the 'real' database because of a stupid error<commit_after>require 'rubygems'
require 'rack/test'
require File.expand_path("../../config/environment", __FILE__)

ENV["RACK_ENV"] = 'test'

config = JSON.parse(File.read("./config.test.json"), symbolize_names: true)

# Expects the user who executes `rspec` to also have postgres login rights - without password
system "psql postgres -c 'DROP DATABASE IF EXISTS \"#{config[:db][:database]}\"'"
system "createdb \"#{config[:db][:database]}\""
system "psql \"#{config[:db][:database]}\" -c 'CREATE EXTENSION hstore'"
system "psql \"#{config[:db][:database]}\" -c 'CREATE EXTENSION postgis'"
system "psql \"#{config[:db][:database]}\" -c 'CREATE EXTENSION pg_trgm'"

# Run migrations - initialize tables, constants and functions
system "cd db && ruby run_migrations.rb test"

RSpec.configure do |c|
  c.mock_with :rspec
  c.expect_with :rspec
end

{'fraction_non_alphanumeric': 0.1732152739346984, 'fraction_numerical': 0.0, 'mean_word_length': 5.411347517730497, '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': '6301720', 'n_tokens_mistral': 619, 'n_tokens_neox': 610, 'n_words': 178}