<commit_before>ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'mocha'
require 'factories'
Dir[Rails.root.join('test/support/*.rb')].each { |f| require f }

class ActiveSupport::TestCase
  include Factory::Syntax::Methods
end

class ActionController::TestCase
  include CssSelectors
  def login_as(name, attributes={})
    user = User.find_or_create_by_name(name, attributes)
    session[:user_id] = user.id
    user
  end

  def assert_login_required
    assert_redirected_to login_path
  end

  def assert_select_object(object, *args, &block)
    assert_select record_css_selector(object), *args, &block
  end
end

class ActionMailer::TestCase
  def self.enable_url_helpers
    # See http://jakegoulding.com/blog/2011/02/26/using-named-routes-in-actionmailer-tests-with-rails-3/
    include Rails.application.routes.url_helpers
    define_method :default_url_options do
      Rails.application.config.action_mailer.default_url_options
    end
  end
end<commit_msg>Fail fast if we stub a method that doesn't exist.<commit_after>ENV["RAILS_ENV"] = "test"
require File.expand_path('../../config/environment', __FILE__)
require 'rails/test_help'
require 'mocha'
require 'factories'
Dir[Rails.root.join('test/support/*.rb')].each { |f| require f }

Mocha::Configuration.prevent(:stubbing_non_existent_method)

class ActiveSupport::TestCase
  include Factory::Syntax::Methods
end

class ActionController::TestCase
  include CssSelectors
  def login_as(name, attributes={})
    user = User.find_or_create_by_name(name, attributes)
    session[:user_id] = user.id
    user
  end

  def assert_login_required
    assert_redirected_to login_path
  end

  def assert_select_object(object, *args, &block)
    assert_select record_css_selector(object), *args, &block
  end
end

class ActionMailer::TestCase
  def self.enable_url_helpers
    # See http://jakegoulding.com/blog/2011/02/26/using-named-routes-in-actionmailer-tests-with-rails-3/
    include Rails.application.routes.url_helpers
    define_method :default_url_options do
      Rails.application.config.action_mailer.default_url_options
    end
  end
end
{'fraction_non_alphanumeric': 0.10738871041762277, 'fraction_numerical': 0.008260670032124828, 'mean_word_length': 4.891891891891892, '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': '5859033', 'n_tokens_mistral': 728, 'n_tokens_neox': 711, 'n_words': 137}