Sha256: 1c64eef0d8054ac33858bf500ec1709db9c2e09d39d03fab2057f12f6c185da4

Contents?: true

Size: 938 Bytes

Versions: 4

Compression:

Stored size: 938 Bytes

Contents

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

  SimpleCov.formatter = Coveralls::SimpleCov::Formatter

  SimpleCov.start do
    add_filter "spec/"
  end
end

require "active_record"
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|
  sql = payload[:sql]
  $__arel_mysql_index_hint_sql_log__ << sql.gsub(/\s+/, " ") if 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

4 entries across 4 versions & 1 rubygems

Version Path
arel-mysql-index-hint-0.2.0 spec/spec_helper.rb
arel-mysql-index-hint-0.1.4 spec/spec_helper.rb
arel-mysql-index-hint-0.1.3 spec/spec_helper.rb
arel-mysql-index-hint-0.1.2 spec/spec_helper.rb