Sha256: fd40a3505d90ce92eb2711282b94b3e25f1bce9adccd5d21e21d4b322c3fb64a

Contents?: true

Size: 777 Bytes

Versions: 5

Compression:

Stored size: 777 Bytes

Contents

require 'lib/activerecord_test_connector'

class ActiveRecordTestCase < ActiveRecord::TestCase
  include ActiveRecord::TestFixtures

  # Set our fixture path
  if ActiveRecordTestConnector.able_to_connect
    self.fixture_path = File.join(File.dirname(__FILE__), '..', 'fixtures')
    self.use_transactional_fixtures = true
  end

  def self.fixtures(*args)
    super if ActiveRecordTestConnector.connected
  end

  def run(*args)
    super if ActiveRecordTestConnector.connected
  end

  protected

  def assert_queries(num = 1)
    $query_count = 0
    yield
  ensure
    assert_equal num, $query_count, "#{$query_count} instead of #{num} queries were executed."
  end

  def assert_no_queries(&block)
    assert_queries(0, &block)
  end
end

ActiveRecordTestConnector.setup

Version data entries

5 entries across 4 versions & 2 rubygems

Version Path
sjain-natural_key-0.1.0 test/lib/activerecord_test_case.rb
natural_key-0.2.2 test/lib/activerecord_test_case.rb
natural_key-0.2.1 test/lib/activerecord_test_case.rb
natural_key-0.2.0 pkg/natural_key-0.1.0/test/lib/activerecord_test_case.rb
natural_key-0.2.0 test/lib/activerecord_test_case.rb