Sha256: 14572df7987c6bb8155b02ba8816349ec180bb04f2d9a5aa9735bd0390fcd975

Contents?: true

Size: 878 Bytes

Versions: 2

Compression:

Stored size: 878 Bytes

Contents

if ENV['TRAVIS']
  require 'simplecov'
  require 'coveralls'

  SimpleCov.formatter = Coveralls::SimpleCov::Formatter

  SimpleCov.start do
    add_filter "spec/"
  end
end

require "arel-mysql-index-hint"
require "models"

$__arel_mysql_index_hint_sql_log__ = []

ActiveSupport::Notifications.subscribe('sql.active_record') do |name, start, finish, id, payload|
  $__arel_mysql_index_hint_sql_log__ << payload[:sql]
end

RSpec.configure do |config|
  config.before(:all) do
    init_database

    ActiveRecord::Base.establish_connection(
      adapter: 'mysql2',
      database: 'arel_mysql_index_hint_test'
    )
  end

  config.before(:each) do
    $__arel_mysql_index_hint_sql_log__.clear
  end
end

def init_database
  sql_file = File.expand_path('../init.sql', __FILE__)
  system("mysql -uroot < #{sql_file}")
end

def sql_log
  $__arel_mysql_index_hint_sql_log__.dup
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
arel-mysql-index-hint-0.1.1 spec/spec_helper.rb
arel-mysql-index-hint-0.1.0 spec/spec_helper.rb