<commit_before>ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rails/test_help'
require 'minitest/emoji'

require 'sunspot_matchers_testunit'

PROCESSING_JOBS = []

class ActionController::TestCase
  def login_account!( login = :louis )
    account = accounts(login)
    @request.session['account_id']      = account.id,
    @request.session['organization_id'] = account.organization_id
  end

  def json_body
    ActiveSupport::JSON.decode(@response.body)
  end
end


class ActiveSupport::TestCase
  ActiveRecord::Migration.check_pending!

  include SunspotMatchersTestunit

  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
  #
  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  fixtures :all

  let (:doc) { documents(:tv_manual) }
  let (:secret_doc){ documents(:top_secret)}
  let (:louis){ accounts(:louis) }
  let (:tribune){ louis.organization }
  let (:joe) { accounts(:reporter_joe) }

  # Add more helper methods to be used by all tests here...

  def setup
    Sunspot.session = SunspotMatchersTestunit::SunspotSessionSpy.new(Sunspot.session)
  end
  def teardown
    PROCESSING_JOBS.clear
  end

  def assert_working_relations( model, relations )
    failed = []
    relations.each do | name |
      begin<commit_msg>Include sunspot helper in controller tests<commit_after>ENV["RAILS_ENV"] = "test"
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
require 'rails/test_help'
require 'minitest/emoji'

require 'sunspot_matchers_testunit'

PROCESSING_JOBS = []

class ActionController::TestCase
  include SunspotMatchersTestunit

  def login_account!( login = :louis )
    account = accounts(login)
    @request.session['account_id']      = account.id,
    @request.session['organization_id'] = account.organization_id
  end

  def json_body
    ActiveSupport::JSON.decode(@response.body)
  end

  setup do
    Sunspot.session = SunspotMatchersTestunit::SunspotSessionSpy.new(Sunspot.session)
  end
  teardown do
    PROCESSING_JOBS.clear
  end

end


class ActiveSupport::TestCase
  ActiveRecord::Migration.check_pending!

   include SunspotMatchersTestunit

  # Setup all fixtures in test/fixtures/*.yml for all tests in alphabetical order.
  #
  # Note: You'll currently still have to declare fixtures explicitly in integration tests
  # -- they do not yet inherit this setting
  fixtures :all

  let (:doc) { documents(:tv_manual) }
  let (:secret_doc){ documents(:top_secret)}
  let (:louis){ accounts(:louis) }
  let (:tribune){ louis.organization }
  let (:joe) { accounts(:reporter_joe) }

  # Add more helper methods to be used by all tests here...

  setup do
    Sunspot.session = SunspotMatchersTestunit::SunspotSessionSpy.new(Sunspot.session)
  end
  teardown do
    PROCESSING_JOBS.clear
  end

  def assert_working_relations( model, relations )
    failed = []
    relations.each do | name |
      begin
{'fraction_non_alphanumeric': 0.10111989459815547, 'fraction_numerical': 0.0, 'mean_word_length': 4.2543252595155705, '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': '2839492', 'n_tokens_mistral': 985, 'n_tokens_neox': 931, 'n_words': 237}