Sha256: ad740d689f9d2a4aae711e85c4d9293976d3c9835f2b62639af6f912a1305e6c

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

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

require 'rubygems'
require 'rspec/autorun'

require 'active_record'
require 'action_controller'
require 'action_view'
require 'action_mailer'

require 'active_enum'

RAILS_ROOT = File.dirname(__FILE__)

require 'rspec/rails'

ActiveRecord::Migration.verbose = false
ActiveRecord::Base.establish_connection({:adapter => 'sqlite3', :database => ':memory:'})
ActiveRecord::Base.logger = Logger.new('/dev/null')

require 'schema'

class Person < ActiveRecord::Base; end

class NotActiveRecord
  include ActiveModel::Validations
  attr_accessor :name
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

1 entries across 1 versions & 1 rubygems

Version Path
active_enum-0.8.2 spec/spec_helper.rb