Instiki 0.16.3: Rails 2.3.0
Instiki now runs on the Rails 2.3.0 Candidate Release. Among other improvements, this means that it now automagically selects between WEBrick and Mongrel. Just run ./instiki --daemon
This commit is contained in:
parent
43aadecc99
commit
4e14ccc74d
893 changed files with 71965 additions and 28511 deletions
|
@ -2,13 +2,10 @@ require 'abstract_unit'
|
|||
|
||||
uses_mocha 'dispatcher tests' do
|
||||
|
||||
require 'action_controller/dispatcher'
|
||||
|
||||
class DispatcherTest < Test::Unit::TestCase
|
||||
Dispatcher = ActionController::Dispatcher
|
||||
|
||||
def setup
|
||||
@output = StringIO.new
|
||||
ENV['REQUEST_METHOD'] = 'GET'
|
||||
|
||||
# Clear callbacks as they are redefined by Dispatcher#define_dispatcher_callbacks
|
||||
|
@ -18,7 +15,7 @@ class DispatcherTest < Test::Unit::TestCase
|
|||
|
||||
Dispatcher.stubs(:require_dependency)
|
||||
|
||||
@dispatcher = Dispatcher.new(@output)
|
||||
@dispatcher = Dispatcher.new
|
||||
end
|
||||
|
||||
def teardown
|
||||
|
@ -27,17 +24,12 @@ class DispatcherTest < Test::Unit::TestCase
|
|||
|
||||
def test_clears_dependencies_after_dispatch_if_in_loading_mode
|
||||
ActiveSupport::Dependencies.expects(:clear).once
|
||||
dispatch(@output, false)
|
||||
dispatch(false)
|
||||
end
|
||||
|
||||
def test_reloads_routes_before_dispatch_if_in_loading_mode
|
||||
ActionController::Routing::Routes.expects(:reload).once
|
||||
dispatch(@output, false)
|
||||
end
|
||||
|
||||
def test_clears_asset_tag_cache_before_dispatch_if_in_loading_mode
|
||||
ActionView::Helpers::AssetTagHelper::AssetTag::Cache.expects(:clear).once
|
||||
dispatch(@output, false)
|
||||
dispatch(false)
|
||||
end
|
||||
|
||||
def test_leaves_dependencies_after_dispatch_if_not_in_loading_mode
|
||||
|
@ -53,12 +45,16 @@ class DispatcherTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
def test_failsafe_response
|
||||
CGI.expects(:new).raises('some multipart parsing failure')
|
||||
Dispatcher.expects(:log_failsafe_exception)
|
||||
Dispatcher.any_instance.expects(:dispatch).raises('b00m')
|
||||
ActionController::Failsafe.any_instance.expects(:log_failsafe_exception)
|
||||
|
||||
assert_nothing_raised { dispatch }
|
||||
|
||||
assert_equal "Status: 400 Bad Request\r\nContent-Type: text/html\r\n\r\n<html><body><h1>400 Bad Request</h1></body></html>", @output.string
|
||||
assert_nothing_raised do
|
||||
assert_equal [
|
||||
500,
|
||||
{"Content-Type" => "text/html"},
|
||||
"<html><body><h1>500 Internal Server Error</h1></body></html>"
|
||||
], dispatch
|
||||
end
|
||||
end
|
||||
|
||||
def test_prepare_callbacks
|
||||
|
@ -79,7 +75,7 @@ class DispatcherTest < Test::Unit::TestCase
|
|||
|
||||
# Make sure they are only run once
|
||||
a = b = c = nil
|
||||
@dispatcher.send :dispatch
|
||||
dispatch
|
||||
assert_nil a || b || c
|
||||
end
|
||||
|
||||
|
@ -94,15 +90,10 @@ class DispatcherTest < Test::Unit::TestCase
|
|||
end
|
||||
|
||||
private
|
||||
def dispatch(output = @output, cache_classes = true)
|
||||
controller = mock
|
||||
controller.stubs(:process).returns(controller)
|
||||
controller.stubs(:out).with(output).returns('response')
|
||||
|
||||
ActionController::Routing::Routes.stubs(:recognize).returns(controller)
|
||||
|
||||
def dispatch(cache_classes = true)
|
||||
ActionController::Routing::RouteSet.any_instance.stubs(:call).returns([200, {}, 'response'])
|
||||
Dispatcher.define_dispatcher_callbacks(cache_classes)
|
||||
Dispatcher.dispatch(nil, {}, output)
|
||||
@dispatcher.call({})
|
||||
end
|
||||
|
||||
def assert_subclasses(howmany, klass, message = klass.subclasses.inspect)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue