Sha256: a53d57a66b676ee5f6a750d45aa823e9939271bfd0272592b38eca30b646bd98

Contents?: true

Size: 1.27 KB

Versions: 2

Compression:

Stored size: 1.27 KB

Contents

require 'coverage_helper'
require 'active_git'
require 'logger'

Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each {|f| require f}

ActiveRecord::Migrator.migrations_path = "#{File.dirname(__FILE__)}/migrations"
ActiveRecord::Migration.verbose = false

logger = Logger.new($stdout)
logger.level = Logger::Severity::FATAL

ActiveRecord::Base.logger = logger
ActiveGit.configuration.logger = logger

module InflectorHelper
  def git_dirname(model, working_path=nil)
    ActiveGit::Inflector.dirname(model, working_path || ActiveGit.configuration.working_path)
  end

  def git_filename(instance, working_path=nil)
    ActiveGit::Inflector.filename(instance, working_path || ActiveGit.configuration.working_path)
  end
end

RSpec.configure do |config|

  config.around do |example|
    ActiveRecord::Base.transaction do
      example.run
      raise ActiveRecord::Rollback
    end
  end

  config.before :all do
    if ENV['DB'] == 'postgresql'
      ActiveRecord::Base.establish_connection adapter: 'postgresql', database: 'test', username: 'postgres'
    else
      ActiveRecord::Base.establish_connection adapter: 'sqlite3', database: ':memory:'
    end
    ActiveRecord::Base.connection
    ActiveRecord::Migrator.migrate ActiveRecord::Migrator.migrations_path
  end

  include InflectorHelper

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
active_git-0.0.8 spec/spec_helper.rb
active_git-0.0.7 spec/spec_helper.rb