Created
October 17, 2008 15:24
-
-
Save lifo/17441 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/actionpack/test/controller/resources_test.rb b/actionpack/test/controller/resources_test.rb | |
index 1fea82e..7a98102 100644 | |
--- a/actionpack/test/controller/resources_test.rb | |
+++ b/actionpack/test/controller/resources_test.rb | |
@@ -747,6 +747,26 @@ class ResourcesTest < Test::Unit::TestCase | |
end | |
end | |
+ def test_resources_with_actions | |
+ with_routing do |set| | |
+ set.draw do |map| | |
+ map.resources :threads, :actions => [:index, :show], :formatted => :index do |post| | |
+ post.resources :comments, :actions => { :except => [:update, :destroy] }, :formatted => :none | |
+ end | |
+ end | |
+ | |
+ assert_recognizes({:controller => 'threads', :action => 'index'}, '/threads', :method => :get) | |
+ assert_recognizes({:controller => 'threads', :action => 'show', :id => '1'}, '/threads/1', :method => :get) | |
+ assert_does_not_recognize '/threads/1/edit', :method => :get | |
+ end | |
+ end | |
+ | |
+ def assert_does_not_recognize(path, options) | |
+ assert_raises(ActionController::RoutingError) do | |
+ ActionController::Routing::Routes.recognize_path(path, options) | |
+ end | |
+ end | |
+ | |
def test_with_path_segment | |
with_restful_routing :messages, :as => 'reviews' do | |
assert_simply_restful_for :messages, :as => 'reviews' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment