Sha256: 3ce1d747b1a49f01b18ffecd377bdc3a20d8fe87b58a7813d08d0295c5c7bdeb

Contents?: true

Size: 1 KB

Versions: 1

Compression:

Stored size: 1 KB

Contents

$:.unshift File.expand_path('../lib', __FILE__)

require 'rspec'
require 'sqlite3'

require 'camaraderie'

# Require our macros and extensions
Dir[File.expand_path('../../spec/support/macros/*.rb', __FILE__)].map(&method(:require))

# Inject our methods into ActiveRecord (like our railtie does)
ActiveRecord::Base.class_eval(&Camaraderie.inject_into_active_record)

RSpec.configure do |config|
  # Include our macros
  config.include DatabaseMacros
  config.include ModelMacros
  config.include RailsMacros

  config.before(:each) do
    # Create the SQLite database
    setup_database

    # Run our migration
    run_default_migration

    # Reset Camaraderie.configuration
    Camaraderie.instance_variable_set(:@configuration, nil)

    # Prepare our models array
    @spawned_models = []
  end

  config.after(:each) do
    # Make sure we remove our test database file
    cleanup_database

    # Remove our models
    @spawned_models.each { |model| Object.instance_eval { remove_const model.name.to_sym } }
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
camaraderie-0.2 spec/spec_helper.rb