Sha256: 12082ff0ee16f602630ae55beed5bf48be552bcdb8909931a188620852a04e6d

Contents?: true

Size: 1.65 KB

Versions: 8

Compression:

Stored size: 1.65 KB

Contents

$:.unshift(File.dirname(__FILE__) + '/../lib')

require 'test/unit'
require File.expand_path(File.join(File.dirname(__FILE__), '../../../../config/environment.rb'))
require 'breakpoint'
require 'active_record/fixtures'
require 'action_controller/test_process'

config = YAML::load(IO.read(File.dirname(__FILE__) + '/database.yml'))
ActiveRecord::Base.logger = Logger.new(File.dirname(__FILE__) + "/debug.log")
ActiveRecord::Base.establish_connection(config[ENV['DB'] || 'sqlite3'])

load(File.dirname(__FILE__) + "/schema.rb")

ActiveSupport::TestCase.fixture_path = File.dirname(__FILE__) + "/fixtures/"
$LOAD_PATH.unshift(ActiveSupport::TestCase.fixture_path)

class ActiveSupport::TestCase #:nodoc:
  include ActionDispatch::TestProcess
  def create_fixtures(*table_names)
    if block_given?
      Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names) { yield }
    else
      Fixtures.create_fixtures(ActiveSupport::TestCase.fixture_path, table_names)
    end
  end

  # Turn off transactional fixtures if you're working with MyISAM tables in MySQL
  self.use_transactional_fixtures = true
  
  # Instantiated fixtures are slow, but give you @david where you otherwise would need people(:david)
  self.use_instantiated_fixtures  = false

  def assert_difference(object, method = nil, difference = 1)
    initial_value = object.send(method)
    yield
    assert_equal initial_value + difference,
      object.send(method)
  end

  def assert_no_difference(object, method, &block)
    assert_difference object, method, 0, &block
  end
end

require File.join(File.dirname(__FILE__), 'fixtures/test_post')
require File.join(File.dirname(__FILE__), 'fixtures/test_user')

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
community_engine-2.3.2 vendor/plugins/activity_tracker/test/abstract_unit.rb
community_engine-2.3.1 vendor/plugins/activity_tracker/test/abstract_unit.rb
community_engine-2.3.0 vendor/plugins/activity_tracker/test/abstract_unit.rb
community_engine-2.1.0 vendor/plugins/activity_tracker/test/abstract_unit.rb
community_engine-2.0.0 vendor/plugins/activity_tracker/test/abstract_unit.rb
community_engine-2.0.0.beta3 vendor/plugins/activity_tracker/test/abstract_unit.rb
community_engine-2.0.0.beta2 vendor/plugins/activity_tracker/test/abstract_unit.rb
community_engine-2.0.0.beta1 vendor/plugins/activity_tracker/test/abstract_unit.rb