mirror of
https://github.com/rails/rails.git
synced 2022-11-09 12:12:34 -05:00
Failing test for routes with member & requirement [#2054 state:resolved]
Signed-off-by: Joshua Peek <josh@joshpeek.com>
This commit is contained in:
parent
b1c989f28d
commit
5b7527ca44
2 changed files with 14 additions and 1 deletions
|
@ -670,7 +670,12 @@ module ActionController
|
|||
when "show", "edit"; default_options.merge(add_conditions_for(resource.conditions, method || :get)).merge(resource.requirements(require_id))
|
||||
when "update"; default_options.merge(add_conditions_for(resource.conditions, method || :put)).merge(resource.requirements(require_id))
|
||||
when "destroy"; default_options.merge(add_conditions_for(resource.conditions, method || :delete)).merge(resource.requirements(require_id))
|
||||
else default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
|
||||
else
|
||||
if method.nil? || resource.member_methods.nil? || resource.member_methods[method.to_sym].nil?
|
||||
default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
|
||||
else
|
||||
resource.member_methods[method.to_sym].include?(action) ? default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements(require_id)) : default_options.merge(add_conditions_for(resource.conditions, method)).merge(resource.requirements)
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
@ -209,6 +209,14 @@ class ResourcesTest < ActionController::TestCase
|
|||
end
|
||||
end
|
||||
|
||||
def test_with_member_action_and_requirement
|
||||
expected_options = {:controller => 'messages', :action => 'mark', :id => '1.1.1'}
|
||||
|
||||
with_restful_routing(:messages, :requirements => {:id => /[0-9]\.[0-9]\.[0-9]/}, :member => { :mark => :get }) do
|
||||
assert_recognizes(expected_options, :path => 'messages/1.1.1/mark', :method => :get)
|
||||
end
|
||||
end
|
||||
|
||||
def test_member_when_override_paths_for_default_restful_actions_with
|
||||
[:put, :post].each do |method|
|
||||
with_restful_routing :messages, :member => { :mark => method }, :path_names => {:new => 'nuevo'} do
|
||||
|
|
Loading…
Reference in a new issue