Sha256: 6d6f1ad0878bdf9946639a49332c35a40a5bba1a478c7d88ccd4e4f2e43b9cfa

Contents?: true

Size: 630 Bytes

Versions: 1

Compression:

Stored size: 630 Bytes

Contents

ENV["RAILS_ENV"]="test"
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'logger'
require 'cat_tree'

ActiveRecord::Base.establish_connection(
  :adapter => 'mysql2',
  :encoding => 'utf8',
  :reconnect => false,
  :database => 'cat_tree_test',
  :username => 'root',
  :pool =>  5,
  :timeout => 5000
)

module TruncateTable
  def truncate
    connection.execute("TRUNCATE TABLE #{table_name}")
  end
end

class User < ActiveRecord::Base
  extend TruncateTable
  has_many :articles
end

class Article < ActiveRecord::Base
  extend TruncateTable
  belongs_to :user
end

CatTree::Initializer.extend_active_record

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cat_tree-0.0.1 spec/spec_helper.rb