Sha256: 65769d0225d1b75ea950592669324b30ca0db0a8cd4cb6963070a6d54bb1f8bc

Contents?: true

Size: 814 Bytes

Versions: 1

Compression:

Stored size: 814 Bytes

Contents

# encoding: utf-8
require 'rubygems'    
require 'active_record'  
require 'yaml'           
require File.expand_path("../../lib/enum_attr", __FILE__)

dbconfig = YAML::load(File.open(File.dirname(__FILE__) + "/database.yml"))    
ActiveRecord::Base.establish_connection(dbconfig)

#migrations
class CreateAllTables < ActiveRecord::Migration
  def self.up
    create_table(:contracts) do |t|
      t.string :name
      t.integer :status
    end
  end
end

RSpec.configure do |config|
  config.before :all do
    # ActiveRecord::Base.connection.execute 
    # 'CREATE TABLE "users" ("id" INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, "name" varchar(255))' 
    # unless ActiveRecord::Base.connection.table_exists? 'users'
    CreateAllTables.up unless ActiveRecord::Base.connection.table_exists? 'contracts'
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
enum_attr-0.0.7 spec/spec_helper.rb