提交 13bb4a6e 编写于 作者: J José Valim

Current url helpers become actions in controller. Added a failing test case for it.

上级 d03af48a
...@@ -124,11 +124,11 @@ def setup ...@@ -124,11 +124,11 @@ def setup
def test_action_methods def test_action_methods
@empty_controllers.each do |c| @empty_controllers.each do |c|
assert_equal Set.new, c.class.__send__(:action_methods), "#{c.controller_path} should be empty!" assert_equal Set.new, c.class.action_methods, "#{c.controller_path} should be empty!"
end end
@non_empty_controllers.each do |c| @non_empty_controllers.each do |c|
assert_equal Set.new(%w(public_action)), c.class.__send__(:action_methods), "#{c.controller_path} should not be empty!" assert_equal Set.new(%w(public_action)), c.class.action_methods, "#{c.controller_path} should not be empty!"
end end
end end
...@@ -191,7 +191,7 @@ def setup ...@@ -191,7 +191,7 @@ def setup
def test_url_options_override def test_url_options_override
with_routing do |set| with_routing do |set|
set.draw do |map| set.draw do
match 'from_view', :to => 'url_options#from_view', :as => :from_view match 'from_view', :to => 'url_options#from_view', :as => :from_view
match ':controller/:action' match ':controller/:action'
end end
...@@ -203,6 +203,17 @@ def test_url_options_override ...@@ -203,6 +203,17 @@ def test_url_options_override
assert_equal 'http://www.override.com/default_url_options/new?locale=en', @controller.url_for(:controller => 'default_url_options') assert_equal 'http://www.override.com/default_url_options/new?locale=en', @controller.url_for(:controller => 'default_url_options')
end end
end end
def test_url_helpers_does_not_become_actions
with_routing do |set|
set.draw do
match "account/overview"
end
@controller.class.send(:include, set.url_helpers)
assert !@controller.class.action_methods.include?("account_overview_path")
end
end
end end
class DefaultUrlOptionsTest < ActionController::TestCase class DefaultUrlOptionsTest < ActionController::TestCase
...@@ -216,7 +227,7 @@ def setup ...@@ -216,7 +227,7 @@ def setup
def test_default_url_options_override def test_default_url_options_override
with_routing do |set| with_routing do |set|
set.draw do |map| set.draw do
match 'from_view', :to => 'default_url_options#from_view', :as => :from_view match 'from_view', :to => 'default_url_options#from_view', :as => :from_view
match ':controller/:action' match ':controller/:action'
end end
...@@ -231,7 +242,7 @@ def test_default_url_options_override ...@@ -231,7 +242,7 @@ def test_default_url_options_override
def test_default_url_options_are_used_in_non_positional_parameters def test_default_url_options_are_used_in_non_positional_parameters
with_routing do |set| with_routing do |set|
set.draw do |map| set.draw do
scope("/:locale") do scope("/:locale") do
resources :descriptions resources :descriptions
end end
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册