[RESTORES BUILD] Added assert_recognizes to test_helper.rb, pending commit of Rails patch 638
This commit is contained in:
parent
f389d84453
commit
1fa143f5d4
|
@ -56,6 +56,23 @@ class Test::Unit::TestCase
|
||||||
ApplicationController.wiki = nil
|
ApplicationController.wiki = nil
|
||||||
end
|
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
|
end
|
||||||
|
|
||||||
class WikiServiceWithNoPersistence
|
class WikiServiceWithNoPersistence
|
||||||
|
|
Loading…
Reference in a new issue