]> source.dussan.org Git - redmine.git/commitdiff
test: replace "should_route" of "versions" to "assert_routing" at integration/routing...
authorToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 18 Dec 2011 08:13:19 +0000 (08:13 +0000)
committerToshi MARUYAMA <marutosijp2@yahoo.co.jp>
Sun, 18 Dec 2011 08:13:19 +0000 (08:13 +0000)
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@8274 e93f8b46-1217-0410-a6f0-8f06a7374b81

test/integration/routing_test.rb

index 28558f18d7f4e651edf347c7b853e0dd641b2889..a83ff6006c225608de2544c1073cb02f6bf8cfb2 100644 (file)
@@ -1192,33 +1192,93 @@ class RoutingTest < ActionController::IntegrationTest
       )
   end
 
-  context "versions" do
+  def test_versions
     # /projects/foo/versions is /projects/foo/roadmap
-    should_route :get, "/projects/foo/versions.xml", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'xml'
-    should_route :get, "/projects/foo/versions.json", :controller => 'versions', :action => 'index', :project_id => 'foo', :format => 'json'
-
-    should_route :get, "/projects/foo/versions/new", :controller => 'versions', :action => 'new', :project_id => 'foo'
-
-    should_route :post, "/projects/foo/versions", :controller => 'versions', :action => 'create', :project_id => 'foo'
-    should_route :post, "/projects/foo/versions.xml", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'xml'
-    should_route :post, "/projects/foo/versions.json", :controller => 'versions', :action => 'create', :project_id => 'foo', :format => 'json'
-
-    should_route :get, "/versions/1", :controller => 'versions', :action => 'show', :id => '1'
-    should_route :get, "/versions/1.xml", :controller => 'versions', :action => 'show', :id => '1', :format => 'xml'
-    should_route :get, "/versions/1.json", :controller => 'versions', :action => 'show', :id => '1', :format => 'json'
-
-    should_route :get, "/versions/1/edit", :controller => 'versions', :action => 'edit', :id => '1'
-
-    should_route :put, "/versions/1", :controller => 'versions', :action => 'update', :id => '1'
-    should_route :put, "/versions/1.xml", :controller => 'versions', :action => 'update', :id => '1', :format => 'xml'
-    should_route :put, "/versions/1.json", :controller => 'versions', :action => 'update', :id => '1', :format => 'json'
-
-    should_route :delete, "/versions/1", :controller => 'versions', :action => 'destroy', :id => '1'
-    should_route :delete, "/versions/1.xml", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'xml'
-    should_route :delete, "/versions/1.json", :controller => 'versions', :action => 'destroy', :id => '1', :format => 'json'
-
-    should_route :put, "/projects/foo/versions/close_completed", :controller => 'versions', :action => 'close_completed', :project_id => 'foo'
-    should_route :post, "/versions/1/status_by", :controller => 'versions', :action => 'status_by', :id => '1'
+    assert_routing(
+        { :method => 'get', :path => "/projects/foo/versions.xml" },
+        { :controller => 'versions', :action => 'index',
+          :project_id => 'foo', :format => 'xml' }
+      )
+    assert_routing(
+        { :method => 'get', :path => "/projects/foo/versions.json" },
+        { :controller => 'versions', :action => 'index',
+          :project_id => 'foo', :format => 'json' }
+      )
+    assert_routing(
+        { :method => 'get', :path => "/projects/foo/versions/new" },
+        { :controller => 'versions', :action => 'new',
+          :project_id => 'foo' }
+      )
+    assert_routing(
+        { :method => 'post', :path => "/projects/foo/versions" },
+        { :controller => 'versions', :action => 'create',
+          :project_id => 'foo' }
+      )
+    assert_routing(
+        { :method => 'post', :path => "/projects/foo/versions.xml" },
+        { :controller => 'versions', :action => 'create',
+          :project_id => 'foo', :format => 'xml' }
+      )
+    assert_routing(
+        { :method => 'post', :path => "/projects/foo/versions.json" },
+        { :controller => 'versions', :action => 'create',
+          :project_id => 'foo', :format => 'json' }
+      )
+    assert_routing(
+        { :method => 'get', :path => "/versions/1" },
+        { :controller => 'versions', :action => 'show', :id => '1' }
+      )
+    assert_routing(
+        { :method => 'get', :path => "/versions/1.xml" },
+        { :controller => 'versions', :action => 'show', :id => '1',
+          :format => 'xml' }
+      )
+    assert_routing(
+        { :method => 'get', :path => "/versions/1.json" },
+        { :controller => 'versions', :action => 'show', :id => '1',
+          :format => 'json' }
+      )
+    assert_routing(
+        { :method => 'get', :path => "/versions/1/edit" },
+        { :controller => 'versions', :action => 'edit', :id => '1' }
+      )
+    assert_routing(
+        { :method => 'put', :path => "/versions/1" },
+        { :controller => 'versions', :action => 'update', :id => '1' }
+      )
+    assert_routing(
+        { :method => 'put', :path => "/versions/1.xml" },
+        { :controller => 'versions', :action => 'update', :id => '1',
+          :format => 'xml' }
+      )
+    assert_routing(
+        { :method => 'put', :path => "/versions/1.json" },
+        { :controller => 'versions', :action => 'update', :id => '1',
+          :format => 'json' }
+      )
+    assert_routing(
+        { :method => 'delete', :path => "/versions/1" },
+        { :controller => 'versions', :action => 'destroy', :id => '1' }
+      )
+    assert_routing(
+        { :method => 'delete', :path => "/versions/1.xml" },
+        { :controller => 'versions', :action => 'destroy', :id => '1',
+          :format => 'xml' }
+      )
+    assert_routing(
+        { :method => 'delete', :path => "/versions/1.json" },
+        { :controller => 'versions', :action => 'destroy', :id => '1',
+          :format => 'json' }
+      )
+    assert_routing(
+        { :method => 'put', :path => "/projects/foo/versions/close_completed" },
+        { :controller => 'versions', :action => 'close_completed',
+          :project_id => 'foo' }
+      )
+    assert_routing(
+        { :method => 'post', :path => "/versions/1/status_by" },
+        { :controller => 'versions', :action => 'status_by', :id => '1' }
+      )
   end
 
   def test_welcome