<commit_before>if ENV['CI']
  require 'coveralls'
  Coveralls.wear_merged!('rails')
end

ENV['RAILS_ENV'] = 'test'
require './config/environment'

require 'rspec/expectations'
require 'mocha/setup'

# Require all shared step files
Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file}

# Setup Javascript tags
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Spinach.hooks.on_tag("javascript") do
  ::Capybara.current_driver = ::Capybara.javascript_driver
end
Capybara.default_wait_time = 10

# Setup Omniauth mock
def omniauth_hash
  {
    info: {
      email: '<EMAIL>',
      name: '<NAME>'
    },
    provider: 'google',
    uid: 'https://www.google.com/accounts/o8/id?id=fakeuid'
  }
end
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock(:google, omniauth_hash)

# DBCleaner
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation

Spinach.hooks.before_scenario { DatabaseCleaner.clean }

# factorygirl niceness
Spinach.hooks.before_run do
  include FactoryGirl::Syntax::Methods
end<commit_msg>Properly teardown Mocha after each scenario<commit_after>if ENV['CI']
  require 'coveralls'
  Coveralls.wear_merged!('rails')
end

ENV['RAILS_ENV'] = 'test'
require './config/environment'

require 'rspec/expectations'
require 'mocha/setup'

# Require all shared step files
Dir["#{Rails.root}/features/steps/shared/*.rb"].each {|file| require file}

# Setup Javascript tags
require 'capybara/poltergeist'
Capybara.javascript_driver = :poltergeist
Spinach.hooks.on_tag("javascript") do
  ::Capybara.current_driver = ::Capybara.javascript_driver
end
Capybara.default_wait_time = 10

# Setup Omniauth mock
def omniauth_hash
  {
    info: {
      email: '<EMAIL>',
      name: '<NAME>'
    },
    provider: 'google',
    uid: 'https://www.google.com/accounts/o8/id?id=fakeuid'
  }
end
OmniAuth.config.test_mode = true
OmniAuth.config.add_mock(:google, omniauth_hash)

# DBCleaner
require 'database_cleaner'
DatabaseCleaner.strategy = :truncation

Spinach.hooks.before_scenario { DatabaseCleaner.clean }
Spinach.hooks.after_scenario { Mocha::Mockery.teardown }

# factorygirl niceness
Spinach.hooks.before_run do
  include FactoryGirl::Syntax::Methods
end
{'fraction_non_alphanumeric': 0.12709181365897784, 'fraction_numerical': 0.0027137042062415195, 'mean_word_length': 5.230985915492957, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 2, 'lorem ipsum': 0, 'www.': 2, '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': '2063287', 'n_tokens_mistral': 797, 'n_tokens_neox': 780, 'n_words': 146}