<commit_before># This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'


def test_login_as(role = nil)
  login = generate_user.login
  if role.is_a?(Symbol)
    login = generate_user(role => true).login
  end

  controller.send :current_login=, login
end
alias :login :test_login_as

def generate_user(stubs = {})
  user = User.spawn(stubs) do |user|
    user.login = Login.spawn(:user => user)
  end
  user.save!
  user
end

Spec::Runner.configure do |config|
  # If you're not using ActiveRecord you should remove these
  # lines, delete config/database.yml and disable :active_record
  # in your config/boot.rb
  config.use_transactional_fixtures = true
  config.use_instantiated_fixtures  = false
  config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
end<commit_msg>Magic line of code by Graeme to run the migrations<commit_after># This file is copied to ~/spec when you run 'ruby script/generate rspec'
# from the project root directory.
ENV["RAILS_ENV"] ||= 'test'
require File.dirname(__FILE__) + "/../config/environment" unless defined?(RAILS_ROOT)
require 'spec/autorun'
require 'spec/rails'


def test_login_as(role = nil)
  login = generate_user.login
  if role.is_a?(Symbol)
    login = generate_user(role => true).login
  end

  controller.send :current_login=, login
end
alias :login :test_login_as

def generate_user(stubs = {})
  user = User.spawn(stubs) do |user|
    user.login = Login.spawn(:user => user)
  end
  user.save!
  user
end

Spec::Runner.configure do |config|
  # If you're not using ActiveRecord you should remove these
  # lines, delete config/database.yml and disable :active_record
  # in your config/boot.rb
  config.use_transactional_fixtures = true
  config.use_instantiated_fixtures  = false
  config.fixture_path = RAILS_ROOT + '/spec/fixtures/'
end

ActiveRecord::Migrator.migrate(File.join(File.dirname(__FILE__), "..", "db", "migrate"))
{'fraction_non_alphanumeric': 0.11477761836441894, 'fraction_numerical': 0.0, 'mean_word_length': 4.534391534391534, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 7, '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': '766612', 'n_tokens_mistral': 699, 'n_tokens_neox': 693, 'n_words': 189}