mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
f29ce1f356
Remove superfluous inherited override in Dependencies. r3024@asus: jeremy | 2005-07-12 23:54:28 -0700 Make test the default railties rake target. r3025@asus: jeremy | 2005-07-12 23:55:27 -0700 Encapsulate dispatch call in dispatcher test. r3026@asus: jeremy | 2005-07-12 23:56:14 -0700 Expand dispatcher mock to match full method signature for process. r3027@asus: jeremy | 2005-07-12 23:57:24 -0700 Look for app-specific generators in RAILS_ROOT/generators instead of RAILS_ROOT/script/generators. r3028@asus: jeremy | 2005-07-13 00:00:47 -0700 Update changelog. git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@1819 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
66 lines
1.6 KiB
Ruby
66 lines
1.6 KiB
Ruby
$:.unshift File.dirname(__FILE__) + "/../lib"
|
|
$:.unshift File.dirname(__FILE__) + "/../../actionpack/lib"
|
|
$:.unshift File.dirname(__FILE__) + "/../../actionmailer/lib"
|
|
|
|
require 'test/unit'
|
|
require 'stringio'
|
|
require 'cgi'
|
|
|
|
require 'dispatcher'
|
|
require 'action_controller'
|
|
require 'action_mailer'
|
|
|
|
ACTION_MAILER_DEF = <<AM
|
|
class DispatcherTestMailer < ActionMailer::Base
|
|
end
|
|
AM
|
|
|
|
ACTION_CONTROLLER_DEF = <<AM
|
|
class DispatcherControllerTest < ActionController::Base
|
|
end
|
|
AM
|
|
|
|
class DispatcherTest < Test::Unit::TestCase
|
|
def setup
|
|
@output = StringIO.new
|
|
ENV['REQUEST_METHOD'] = "GET"
|
|
setup_minimal_environment
|
|
end
|
|
|
|
def teardown
|
|
ENV['REQUEST_METHOD'] = nil
|
|
teardown_minimal_environment
|
|
end
|
|
|
|
def test_ac_subclasses_cleared_on_reset
|
|
Object.class_eval(ACTION_CONTROLLER_DEF)
|
|
assert_equal 1, ActionController::Base.subclasses.length
|
|
dispatch
|
|
|
|
GC.start # force the subclass to be collected
|
|
assert_equal 0, ActionController::Base.subclasses.length
|
|
end
|
|
|
|
def test_am_subclasses_cleared_on_reset
|
|
Object.class_eval(ACTION_MAILER_DEF)
|
|
assert_equal 1, ActionMailer::Base.subclasses.length
|
|
dispatch
|
|
|
|
GC.start # force the subclass to be collected
|
|
assert_equal 0, ActionMailer::Base.subclasses.length
|
|
end
|
|
|
|
private
|
|
def dispatch
|
|
Dispatcher.dispatch(CGI.new, ActionController::CgiRequest::DEFAULT_SESSION_OPTIONS, @output)
|
|
end
|
|
|
|
def setup_minimal_environment
|
|
value = Dependencies::LoadingModule.root
|
|
Object.const_set("Controllers", value)
|
|
end
|
|
|
|
def teardown_minimal_environment
|
|
Object.send(:remove_const, "Controllers")
|
|
end
|
|
end
|