Sha256: abef61182e7e63b2f3364cf5ec4e42fab9e5c8ec77e5fb8bddbb1df986602fc6

Contents?: true

Size: 858 Bytes

Versions: 2

Compression:

Stored size: 858 Bytes

Contents

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$:.unshift(File.join(File.dirname(__FILE__), '..', 'spec'))

require 'rubygems'
require 'rspec/autorun'
require 'rspec/rails'

require 'active_record'
require 'active_enum'

RAILS_ROOT = File.dirname(__FILE__)

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

require 'schema'

class Person < ActiveRecord::Base; end

module SpecHelper
  def reset_class(klass, &block)
    name = klass.name.to_sym
    Object.send(:remove_const, name)
    eval "class #{klass}#{' < ' + klass.superclass.to_s if klass.superclass != Class}; end", TOPLEVEL_BINDING
    new_klass = Object.const_get(name)
    new_klass.class_eval &block if block_given?
    new_klass
  end
end

RSpec.configure do |config|
  config.include SpecHelper
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_enum-0.7.1 spec/spec_helper.rb
active_enum-0.7.0 spec/spec_helper.rb