Sha256: 68f135d2245e4a4c4be4ef3887a54235a10dd20609f36bc9af266367e9d835b8

Contents?: true

Size: 985 Bytes

Versions: 2

Compression:

Stored size: 985 Bytes

Contents

require "bundler/setup"
require "pg_audit_log"
require "with_model"

connection = nil
begin
  ActiveRecord::Base.establish_connection(:adapter  => 'postgresql',
                                          :database => 'pg_audit_log_test',
                                          :min_messages => 'warning')
  connection = ActiveRecord::Base.connection
  connection.execute("SELECT 1")
rescue PGError => e
  puts "-" * 80
  puts "Unable to connect to database.  Please run:"
  puts
  puts "    createdb pg_audit_log_test"
  puts "-" * 80
  raise e
end


RSpec.configure do |config|
  config.mock_with :rspec
  config.extend WithModel

  config.before(:all) do
    connection.tables.each do |table|
      connection.drop_table_without_auditing(table)
    end
    PgAuditLog::Triggers.uninstall rescue nil
    PgAuditLog::Entry.uninstall
    PgAuditLog::Entry.install
    PgAuditLog::Function.install
  end

  config.after(:each) do
    ActiveRecord::Base.connection.reconnect!
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
pg_audit_log-0.3.1 spec/spec_helper.rb
pg_audit_log-0.3.0 spec/spec_helper.rb