Sha256: 4ec6ca240934e375a9caae1c1140d16d60b4e64e13880c9a4af6b77184429693

Contents?: true

Size: 856 Bytes

Versions: 1

Compression:

Stored size: 856 Bytes

Contents

require 'mysql2_ext'
require 'mysql_helper'
require 'activerecord/mysql/reconnect'
require 'employee_model'

module SpecHelper
  def thread_start
    thread_running = false

    th = Thread.start {
      thread_running = true
      yield
      thread_running = false
    }

    60.times do
      Thread.pass
      break if thread_running
      sleep 1
    end

    unless thread_running
      raise 'thread is not running'
    end

    th
  end

  def myisam?
    ENV['ACTIVERECORD_MYSQL_RECONNECT_ENGINE'] =~ /MyISAM/i
  end
end

include SpecHelper

RSpec.configure do |config|
  config.before(:all) do
    ENV['MYSQL_PWD'] = 'password'
    MysqlServer.setup
  end

  config.after(:all) do
    MysqlServer.clean
  end

  config.before(:each) do |context|
    MysqlServer.start
    MysqlServer.reset
    ActiveRecord::Base.clear_all_connections!
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
activerecord-mysql-reconnect-0.4.1.beta spec/spec_helper.rb