2009-12-23 17:55:12 -05:00
|
|
|
require "isolation/abstract_unit"
|
|
|
|
|
|
|
|
module PluginsTest
|
|
|
|
class FrameworkExtensionTest < Test::Unit::TestCase
|
2009-12-28 20:45:17 -05:00
|
|
|
include ActiveSupport::Testing::Isolation
|
|
|
|
|
2009-12-28 19:21:48 -05:00
|
|
|
def setup
|
|
|
|
build_app
|
|
|
|
boot_rails
|
2009-12-31 16:11:54 -05:00
|
|
|
FileUtils.rm_rf("#{app_path}/config/environments")
|
2009-12-31 15:28:48 -05:00
|
|
|
require "rails/all"
|
2009-12-28 19:21:48 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
test "rake_tasks block is executed when MyApp.load_tasks is called" do
|
|
|
|
$ran_block = false
|
|
|
|
|
2009-12-31 16:11:54 -05:00
|
|
|
class MyTie < Rails::Railtie
|
2009-12-28 19:21:48 -05:00
|
|
|
rake_tasks do
|
|
|
|
$ran_block = true
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
require "#{app_path}/config/environment"
|
|
|
|
|
|
|
|
assert !$ran_block
|
|
|
|
require 'rake'
|
|
|
|
require 'rake/testtask'
|
|
|
|
require 'rake/rdoctask'
|
2009-12-28 20:45:17 -05:00
|
|
|
|
2009-12-28 19:21:48 -05:00
|
|
|
AppTemplate::Application.load_tasks
|
|
|
|
assert $ran_block
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class ActiveRecordExtensionTest < Test::Unit::TestCase
|
2009-12-28 20:45:17 -05:00
|
|
|
include ActiveSupport::Testing::Isolation
|
|
|
|
|
2009-12-23 17:55:12 -05:00
|
|
|
def setup
|
|
|
|
build_app
|
|
|
|
boot_rails
|
2009-12-31 16:11:54 -05:00
|
|
|
FileUtils.rm_rf("#{app_path}/config/environments")
|
2009-12-23 17:55:12 -05:00
|
|
|
end
|
|
|
|
|
|
|
|
test "active_record extensions are applied to ActiveRecord" do
|
|
|
|
add_to_config "config.active_record.table_name_prefix = 'tbl_'"
|
|
|
|
|
|
|
|
require "#{app_path}/config/environment"
|
|
|
|
|
|
|
|
assert_equal 'tbl_', ActiveRecord::Base.table_name_prefix
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|