<commit_before>ENV["RAILS_ENV"] ||= 'test'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
require 'capybara/rspec'

# ResqueSpec libraries
require 'resque_spec/scheduler' # allow resque spec to test scheduled jobs

# try to load the mongoid config
# Mongoid.load!(Rails.root.join("/config/mongoid.yml"))

# Requires supporting ruby files with custom matchers and macros, etc,
# in spec/support/ and its subdirectories.
Dir[Rails.root.join("spec/support/**/*.rb")].each { |f| require f }
Dir[Rails.root.join("spec/toolkits/**/*.rb")].each { |f| require f }

# Checks for pending migrations before tests are run.
# If you are not using ActiveRecord, you can remove this line.
ActiveRecord::Migration.check_pending! if defined?(ActiveRecord::Migration)
# ActiveRecord::Migration.maintain_test_schema!

# fixture file no longer works, this is a workaround
# here is an alternative solution that didn't work for me:
# http://stackoverflow.com/questions/9011425/fixture-file-upload-has-file-does-not-exist-error
def fixture_file(file, filetype='image/jpg')
  Rack::Test::UploadedFile.new(Rails.root.join('spec', 'fixtures', 'files', file), filetype)
end

def clean_models
  User.destroy_all
  Course.destroy_all
  AssignmentType.destroy_all
  Assignment.destroy_all
end

RSpec.configure do |config|
  config.filter_run :focus
  config.run_all_when_everything_filtered = true

  config.order = :random

  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  if config.files_to_run.one?
    config.default_formatter = 'doc'
  end
end<commit_msg>restore spec helper changes from master<commit_after>ENV["RAILS_ENV"] ||= 'test'

RSpec.configure do |config|
  config.filter_run :focus
  config.run_all_when_everything_filtered = true

  config.order = :random

  config.expect_with :rspec do |expectations|
    expectations.include_chain_clauses_in_custom_matcher_descriptions = true
  end

  config.mock_with :rspec do |mocks|
    mocks.verify_partial_doubles = true
  end

  if config.files_to_run.one?
    config.default_formatter = 'doc'
  end
end
{'fraction_non_alphanumeric': 0.10719071013845467, 'fraction_numerical': 0.0031263957123715946, 'mean_word_length': 5.070460704607046, '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': '6570192', 'n_tokens_mistral': 749, 'n_tokens_neox': 727, 'n_words': 173}