Sha256: da6d8490155795e3ef0d5b6bc7b36cbc8b468e710d8bdb867a8108bbeb650eca

Contents?: true

Size: 905 Bytes

Versions: 9

Compression:

Stored size: 905 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

Version data entries

9 entries across 9 versions & 4 rubygems

Version Path
dm_preferences-0.5.6 test/test_helper.rb
ee_preferences-0.6.3 test/test_helper.rb
ee_preferences-0.6.2 test/test_helper.rb
ee_preferences-0.6.1 test/test_helper.rb
ee_preferences-0.4.3 test/test_helper.rb
optimeez_preferences-0.4.2 test/test_helper.rb
preferences-0.4.2 test/test_helper.rb
preferences-0.4.1 test/test_helper.rb
preferences-0.4.0 test/test_helper.rb