提交 d2205ea5 编写于 作者: R Rick Olson

Improve Test Coverage for...

Improve Test Coverage for ActionController::Routing::Route#matches_controller_and_action? (Heckle++) #7115 [Kevin Clark]

git-svn-id: http://svn-commit.rubyonrails.org/rails/trunk@5976 5ecf4fe2-1ee6-0310-87b1-e25e094e27de
上级 582c028b
*SVN*
* Improve Test Coverage for ActionController::Routing::Route#matches_controller_and_action? (Heckle++) #7115 [Kevin Clark]
* Heckling ActionController::Resources::Resource revealed that set_prefixes didn't break when :name_prefix was munged. #7081 [Kevin Clark]
* Fix #distance_of_time_in_words to report accurately against the Duration class. #7114 [eventualbuddha]
......
......@@ -774,6 +774,8 @@ def test_regexp_should_only_match_possible_controllers
end
uses_mocha 'RouteTest' do
class RouteTest < Test::Unit::TestCase
def setup
......@@ -847,7 +849,18 @@ def test_default_route_should_work_with_action_but_no_id
o = {:controller => 'accounts', :action => 'list_all'}
assert_equal '/accounts/list_all', default_route.generate(o, o, {})
end
def test_matches_controller_and_action
# requirement_for should only be called for the action and controller _once_
@route.expects(:requirement_for).with(:controller).times(1).returns('pages')
@route.expects(:requirement_for).with(:action).times(1).returns('show')
@route.requirements = {:controller => 'pages', :action => 'show'}
assert @route.matches_controller_and_action?('pages', 'show')
assert !@route.matches_controller_and_action?('not_pages', 'show')
assert !@route.matches_controller_and_action?('pages', 'not_show')
end
def test_parameter_shell
page_url = ROUTING::Route.new
page_url.requirements = {:controller => 'pages', :action => 'show', :id => /\d+/}
......@@ -934,6 +947,8 @@ def order_query_string(qs)
end
end
end # uses_mocha
class RouteBuilderTest < Test::Unit::TestCase
def builder
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册