public
Description: simple identity map for active record. eager loading associations FTL
Clone URL: git://github.com/technoweenie/active_record_context.git
Click here to lend your support to: active_record_context and make a donation at www.pledgie.com !
active_record_context / test / abstract_unit.rb
100644 31 lines (24 sloc) 0.907 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
$:.unshift(File.dirname(__FILE__) + '/../lib')
$:.unshift(File.dirname(__FILE__) + '/../../../rails/activesupport/lib')
$:.unshift(File.dirname(__FILE__) + '/../../../rails/activerecord/lib')
 
require 'test/unit'
require 'active_support'
require 'active_record'
require 'active_record/fixtures'
require 'technoweenie/active_record_context'
require 'rubygems'
require 'mocha'
 
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'] || 'sqlite'])
 
load(File.dirname(__FILE__) + "/schema.rb")
 
ActiveRecord::Base.send :include, Technoweenie::ActiveRecordContext
 
class Topic < ActiveRecord::Base
end
 
class Post < ActiveRecord::Base; end
class NormalPost < Post
  belongs_to :topic
end
 
class PolymorphPost < Post
  belongs_to :topic, :polymorphic => true
end