<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 'capybara/rspec'
require 'webmock'
require 'patches/rspec_hash_diff'

Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}

RSpec.configure do |config|
  config.mock_with :rspec

  config.include Devise::TestHelpers, :type => :controller
  config.include JsonHelpers

  # config.before(:each, :webmocked => true) do
  #   self.extend WebMock::API
  #   WebMock.disable_net_connect!(:allow_localhost => true)
  # end

  config.before :suite do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with :truncation
  end

  config.before :each do
    DatabaseCleaner.start
  end

  config.after :each do
    DatabaseCleaner.clean
  end
end

WebMock.disable_net_connect!(:allow_localhost => true)<commit_msg>Adding Spork. That does not affect people who don't have it installed.<commit_after># This file is copied to spec/ when you run 'rails generate rspec:install'
ENV["RAILS_ENV"] ||= 'test'

begin
  require 'rubygems'
  require 'spork'
rescue LoadError => e
end

def configure
  require File.expand_path("../../config/environment", __FILE__)
  Dir[Rails.root.join("spec/support/**/*.rb")].each {|f| require f}
  require 'rspec/rails'
  require 'capybara/rspec'
  require 'webmock'
  require 'patches/rspec_hash_diff'
end

if defined? Spork
  Spork.prefork do
    configure
  end

  Spork.each_run do
    Dir["#{Rails.root}/app/**/*.rb"].each { |f| load f }
    Dir["#{Rails.root}/lib/**/*.rb"].each { |f| load f }
    load "#{Rails.root}/config/routes.rb"
  end
else
  configure
end

RSpec.configure do |config|
  config.mock_with :rspec

  config.include Devise::TestHelpers, :type => :controller
  config.include JsonHelpers

  # config.before(:each, :webmocked => true) do
  #   self.extend WebMock::API
  #   WebMock.disable_net_connect!(:allow_localhost => true)
  # end

  config.before :suite do
    DatabaseCleaner.strategy = :transaction
    DatabaseCleaner.clean_with :truncation
  end

  config.before :each do
    DatabaseCleaner.start
  end

  config.after :each do
    DatabaseCleaner.clean
  end
end

WebMock.disable_net_connect!(:allow_localhost => true)
{'fraction_non_alphanumeric': 0.12753999135322092, 'fraction_numerical': 0.0, 'mean_word_length': 4.108167770419426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 12, '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': '3667213', 'n_tokens_mistral': 790, 'n_tokens_neox': 780, 'n_words': 187}