From 1fa143f5d471666984c5b3dbcdc8a2e64a63207b Mon Sep 17 00:00:00 2001 From: Alexey Verkhovsky Date: Sat, 19 Feb 2005 13:58:27 +0000 Subject: [PATCH] [RESTORES BUILD] Added assert_recognizes to test_helper.rb, pending commit of Rails patch 638 --- test/test_helper.rb | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/test/test_helper.rb b/test/test_helper.rb index 9f8fc128..4641446d 100644 --- a/test/test_helper.rb +++ b/test/test_helper.rb @@ -56,6 +56,23 @@ class Test::Unit::TestCase ApplicationController.wiki = nil end + + # Checks that a given URI path is recognized as expected options + # Delete it when patch #638 is commiteed to Rails (http://dev.rubyonrails.org/ticket/638) + def assert_recognizes(expected_options, path) + # Load routes.rb if it hasn't been loaded. + ActionController::Routing::Routes.reload if ActionController::Routing::Routes.empty? + + # Assume given controller + request = ActionController::TestRequest.new({}, {}, nil) + request.path = path + ActionController::Routing::Routes.recognize!(request) + + msg = build_message(nil, "The recognized options did not match ", + request.path_parameters, expected_options) + assert_block(msg) { request.path_parameters == expected_options } + end + end class WikiServiceWithNoPersistence