Sha256: ac588217e8d45d74aa5f1dbe961e24ed9d4fcad3669b659cac7e3622120e5d84

Contents?: true

Size: 905 Bytes

Versions: 3

Compression:

Stored size: 905 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
    MysqlServer.stop
  end

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

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

  config.expect_with :rspec do |c|
    c.max_formatted_output_length = 999999
  end
end

Version data entries

3 entries across 3 versions & 3 rubygems

Version Path
activerecord-mysql-reconnect-new-0.6.0 spec/spec_helper.rb
activerecord-mysql-reconnect-before-retry-0.5.0 spec/spec_helper.rb
activerecord-mysql-reconnect-0.5.0 spec/spec_helper.rb