comparison test/integration/routing/users_test.rb @ 1337:077b8890835a cannam

Merge from live branch
author Chris Cannam
date Thu, 20 Jun 2013 13:14:02 +0100
parents 433d4f72a19b
children 622f24f53b42
comparison
equal deleted inserted replaced
1304:6137548ba453 1337:077b8890835a
1 # Redmine - project management software
2 # Copyright (C) 2006-2012 Jean-Philippe Lang
3 #
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
8 #
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
13 #
14 # You should have received a copy of the GNU General Public License
15 # along with this program; if not, write to the Free Software
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
18 require File.expand_path('../../../test_helper', __FILE__)
19
20 class RoutingUsersTest < ActionController::IntegrationTest
21 def test_users
22 assert_routing(
23 { :method => 'get', :path => "/users" },
24 { :controller => 'users', :action => 'index' }
25 )
26 assert_routing(
27 { :method => 'get', :path => "/users.xml" },
28 { :controller => 'users', :action => 'index', :format => 'xml' }
29 )
30 assert_routing(
31 { :method => 'get', :path => "/users/44" },
32 { :controller => 'users', :action => 'show', :id => '44' }
33 )
34 assert_routing(
35 { :method => 'get', :path => "/users/44.xml" },
36 { :controller => 'users', :action => 'show', :id => '44',
37 :format => 'xml' }
38 )
39 assert_routing(
40 { :method => 'get', :path => "/users/current" },
41 { :controller => 'users', :action => 'show', :id => 'current' }
42 )
43 assert_routing(
44 { :method => 'get', :path => "/users/current.xml" },
45 { :controller => 'users', :action => 'show', :id => 'current',
46 :format => 'xml' }
47 )
48 assert_routing(
49 { :method => 'get', :path => "/users/new" },
50 { :controller => 'users', :action => 'new' }
51 )
52 assert_routing(
53 { :method => 'get', :path => "/users/444/edit" },
54 { :controller => 'users', :action => 'edit', :id => '444' }
55 )
56 assert_routing(
57 { :method => 'post', :path => "/users" },
58 { :controller => 'users', :action => 'create' }
59 )
60 assert_routing(
61 { :method => 'post', :path => "/users.xml" },
62 { :controller => 'users', :action => 'create', :format => 'xml' }
63 )
64 assert_routing(
65 { :method => 'put', :path => "/users/444" },
66 { :controller => 'users', :action => 'update', :id => '444' }
67 )
68 assert_routing(
69 { :method => 'put', :path => "/users/444.xml" },
70 { :controller => 'users', :action => 'update', :id => '444',
71 :format => 'xml' }
72 )
73 assert_routing(
74 { :method => 'delete', :path => "/users/44" },
75 { :controller => 'users', :action => 'destroy', :id => '44' }
76 )
77 assert_routing(
78 { :method => 'delete', :path => "/users/44.xml" },
79 { :controller => 'users', :action => 'destroy', :id => '44',
80 :format => 'xml' }
81 )
82 assert_routing(
83 { :method => 'post', :path => "/users/123/memberships" },
84 { :controller => 'users', :action => 'edit_membership',
85 :id => '123' }
86 )
87 assert_routing(
88 { :method => 'put', :path => "/users/123/memberships/55" },
89 { :controller => 'users', :action => 'edit_membership',
90 :id => '123', :membership_id => '55' }
91 )
92 assert_routing(
93 { :method => 'delete', :path => "/users/123/memberships/55" },
94 { :controller => 'users', :action => 'destroy_membership',
95 :id => '123', :membership_id => '55' }
96 )
97 end
98 end