Sha256: 96fd38a386b495fdc3b04fbac58e47bb5a0bd621e6041b98a66cda650bca074a

Contents?: true

Size: 942 Bytes

Versions: 8

Compression:

Stored size: 942 Bytes

Contents

# Load the plugin testing framework
$:.unshift("#{File.dirname(__FILE__)}/../../plugin_test_helper/lib")
require 'rubygems'
require 'plugin_test_helper'

# Run the migrations
ActiveRecord::Migrator.migrate("#{Rails.root}/db/migrate")

# Mixin the factory helper
require File.expand_path("#{File.dirname(__FILE__)}/factory")
Test::Unit::TestCase.class_eval do
  include Factory
end

# Add query counter
ActiveRecord::Base.connection.class.class_eval do
  IGNORED_SQL = [/^PRAGMA/, /^SELECT currval/, /^SELECT CAST/, /^SELECT @@IDENTITY/, /^SELECT @@ROWCOUNT/, /^SAVEPOINT/, /^ROLLBACK TO SAVEPOINT/, /^RELEASE SAVEPOINT/, /SHOW FIELDS/]
  
  def execute_with_query_record(sql, name = nil, &block)
    $queries_executed ||= []
    $queries_executed << sql unless IGNORED_SQL.any? { |r| sql =~ r }
    execute_without_query_record(sql, name, &block)
  end
  
  alias_method_chain :execute, :query_record
end

EnumerateBy.perform_caching = false

Version data entries

8 entries across 8 versions & 3 rubygems

Version Path
mschuerig-enumerate_by-0.4.2 test/test_helper.rb
pluginaweek-enumerate_by-0.4.2 test/test_helper.rb
pluginaweek-enumerate_by-0.4.3 test/test_helper.rb
enumerate_by-0.4.4 test/test_helper.rb
enumerate_by-0.4.0 test/test_helper.rb
enumerate_by-0.4.1 test/test_helper.rb
enumerate_by-0.4.3 test/test_helper.rb
enumerate_by-0.4.2 test/test_helper.rb