Sha256: 771e36108c689638e28c61a5a70354bacc9649a4b10145297af760a6f586faf5

Contents?: true

Size: 1.26 KB

Versions: 2

Compression:

Stored size: 1.26 KB

Contents

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

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

ActiveRecord::Base.logger = Logger.new($stdout)
ActiveRecord::Base.logger.level = Logger::Severity::ERROR
ActiveRecord::Migrator.migrations_path = "#{File.dirname(__FILE__)}/migrations"

ActiveGit.configuration.logger.level = Logger::Severity::ERROR

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.6 spec/spec_helper.rb
active_git-0.0.5 spec/spec_helper.rb