Sha256: 37c0ec0c497f39dbf57fc2e902b8081eea7577caeda0c6e4578efcd1ca76a405

Contents?: true

Size: 842 Bytes

Versions: 3

Compression:

Stored size: 842 Bytes

Contents

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

require 'rubygems'
require 'spec/autorun'

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

Spec::Runner.configure do |config|
  config.include SpecHelper
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
active_enum-0.6.6 spec/spec_helper.rb
active_enum-0.6.5 spec/spec_helper.rb
active_enum-0.6.4 spec/spec_helper.rb