<commit_before>require 'aruba/cucumber'

ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')

Before do
  @temp_dir = Dir.mktmpdir
  @dirs = [ @temp_dir ]
  # Using "announce" causes massive warnings on 1.9.2
  @puts = true
  @original_rubylib = ENV['RUBYLIB']
  @aruba_timeout_seconds = 10
  ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
end

Before '~@nobackend', '~@noautosignup' do
  if not $account_created
    $unique_id = "#{Time.now.strftime('%Y%m%d%H%M%S')}-#{Random.new.rand(10..99)}"
    $user = "<EMAIL>-#{<EMAIL>"
    signup_with_secret $user
    $account_created = true
    at_exit {
      login_with_secret $user
      run_simple "sphere -f account delete", false, @aruba_timeout_seconds<commit_msg>Double test timeout.<commit_after>require 'aruba/cucumber'

ENV['PATH'] = "#{File.expand_path(File.dirname(__FILE__) + '/../../bin')}#{File::PATH_SEPARATOR}#{ENV['PATH']}"
LIB_DIR = File.join(File.expand_path(File.dirname(__FILE__)),'..','..','lib')

Before do
  @temp_dir = Dir.mktmpdir
  @dirs = [ @temp_dir ]
  # Using "announce" causes massive warnings on 1.9.2
  @puts = true
  @original_rubylib = ENV['RUBYLIB']
  @aruba_timeout_seconds = 20
  ENV['RUBYLIB'] = LIB_DIR + File::PATH_SEPARATOR + ENV['RUBYLIB'].to_s
end

Before '~@nobackend', '~@noautosignup' do
  if not $account_created
    $unique_id = "#{Time.now.strftime('%Y%m%d%H%M%S')}-#{Random.new.rand(10..99)}"
    $user = "<EMAIL>tests+<EMAIL>-#{<EMAIL>"
    signup_with_secret $user
    $account_created = true
    at_exit {
      login_with_secret $user
      run_simple "sphere -f account delete", false, @aruba_timeout_seconds
{'fraction_non_alphanumeric': 0.18848758465011287, 'fraction_numerical': 0.010158013544018058, 'mean_word_length': 4.6826923076923075, 'pattern_counts': {'":': 0, '<': 8, '<?xml version=': 0, '>': 8, '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': '5074444', 'n_tokens_mistral': 713, 'n_tokens_neox': 696, 'n_words': 113}