<commit_before>require 'degu'
require 'test/unit'
require 'mocha/setup'
require 'active_record'
require 'degu/init_active_record_plugins'

ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
ActiveRecord::Migration.verbose = false

def setup_db
  ActiveRecord::Schema.define(:version => 1) do
    create_table :class_with_enums do |t|
      t.column :title, :string
      t.column :product_type, :string
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
    end

    create_table :class_without_enums do |t|
      t.column :title, :string
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
    end

    create_table :class_with_interger_columns do |t|
      t.column :title, :string
      t.column :product_type, :integer
    end

    create_table :class_with_custom_name_enums do |t|
      t.column :title, :string
      t.column :product_enum, :string
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
    end

    create_table :people do |t|
      t.string  :fullname
      t.integer :interests_bitfield, :default => 0
    end

    create_table :punks do |t|
      t.string :fullname
      t.string :bad_habits_bitfield
    end

    create_table :parties do |t|
      t.string  :location
      t.integer :drinks_set, :default => 0
      t.integer :music_bitfield, :default => 0
    end

    create_table :itunes do |t|
      t.string  :location
      t.integer :music_bitfield
    end

    create_table :class_with_large_datasets do |t|
      t.string :dataset_bitfield
    end

    create_table :two_enums_classes do |t|
      t.integer :drinks_bitfield, :default => 0
      t.string :dataset_bitfield, :default => '0'
    end
  end
end

def teardown_db
  ActiveRecord::Base.connection.data_sources.each do |table|
    ActiveRecord::Base.connection.drop_table(table)
  end
end

enum :Fakes, [:NOT_DEFINIED]

enum :Product, [:Silver, :Gold, :Titanium]
<commit_msg>Fixes specs if ActiveRecord version is < 5<commit_after>require 'degu'
require 'test/unit'
require 'mocha/setup'
require 'active_record'
require 'degu/init_active_record_plugins'

ActiveRecord::Base.establish_connection(:adapter => "sqlite3", :database => ":memory:")
ActiveRecord::Migration.verbose = false

def setup_db
  ActiveRecord::Schema.define(:version => 1) do
    create_table :class_with_enums do |t|
      t.column :title, :string
      t.column :product_type, :string
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
    end

    create_table :class_without_enums do |t|
      t.column :title, :string
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
    end

    create_table :class_with_interger_columns do |t|
      t.column :title, :string
      t.column :product_type, :integer
    end

    create_table :class_with_custom_name_enums do |t|
      t.column :title, :string
      t.column :product_enum, :string
      t.column :created_at, :datetime
      t.column :updated_at, :datetime
    end

    create_table :people do |t|
      t.string  :fullname
      t.integer :interests_bitfield, :default => 0
    end

    create_table :punks do |t|
      t.string :fullname
      t.string :bad_habits_bitfield
    end

    create_table :parties do |t|
      t.string  :location
      t.integer :drinks_set, :default => 0
      t.integer :music_bitfield, :default => 0
    end

    create_table :itunes do |t|
      t.string  :location
      t.integer :music_bitfield
    end

    create_table :class_with_large_datasets do |t|
      t.string :dataset_bitfield
    end

    create_table :two_enums_classes do |t|
      t.integer :drinks_bitfield, :default => 0
      t.string :dataset_bitfield, :default => '0'
    end
  end
end

def teardown_db
  if ActiveRecord::VERSION::MAJOR >= 5
    ActiveRecord::Base.connection.data_sources.each do |table|
      ActiveRecord::Base.connection.drop_table(table)
    end
  else
    ActiveRecord::Base.connection.tables.each do |table|
      ActiveRecord::Base.connection.drop_table(table)
    end
  end
end

enum :Fakes, [:NOT_DEFINIED]

enum :Product, [:Silver, :Gold, :Titanium]

{'fraction_non_alphanumeric': 0.10129620739318292, 'fraction_numerical': 0.003840614498319731, 'mean_word_length': 3.243380855397149, 'pattern_counts': {'":': 2, '<': 4, '<?xml version=': 0, '>': 20, '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': '7617670', 'n_tokens_mistral': 1432, 'n_tokens_neox': 1384, 'n_words': 340}