Sha256: 62eb3c8d0631d3bde61ae702ad11fd3fbcc4392bca8e55104b95e3574b21d14a

Contents?: true

Size: 812 Bytes

Versions: 1

Compression:

Stored size: 812 Bytes

Contents

require 'active_record'
require 'sqlite3'

begin
  require 'simplecov'
  SimpleCov.start do
    add_filter "/spec/"
  end
rescue LoadError
  # simplecov not installed
end

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

require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'path_tree'))

module PathTree
  class Test < ActiveRecord::Base
    self.table_name = :test_path_trees

    def self.create_tables
      connection.create_table(table_name) do |t|
        t.string :name
        t.string :node_path
        t.string :path
        t.string :parent_path
      end unless table_exists?
    end

    def self.drop_tables
      connection.drop_table(table_name)
    end

    # lib/path_tree must be loaded before this
    include PathTree
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
path_tree-1.1.0 spec/spec_helper.rb