##// END OF EJS Templates
Adds tests for new routes....
Jean-Philippe Lang -
r13221:cd6b2f2268d3
parent child
Show More
@@ -1,63 +1,67
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../../test_helper', __FILE__)
19 19
20 20 class RoutingMembersTest < ActionDispatch::IntegrationTest
21 21 def test_members
22 22 assert_routing(
23 23 { :method => 'get', :path => "/projects/5234/memberships.xml" },
24 24 { :controller => 'members', :action => 'index', :project_id => '5234', :format => 'xml' }
25 25 )
26 26 assert_routing(
27 27 { :method => 'get', :path => "/memberships/5234.xml" },
28 28 { :controller => 'members', :action => 'show', :id => '5234', :format => 'xml' }
29 29 )
30 30 assert_routing(
31 31 { :method => 'post', :path => "/projects/5234/memberships" },
32 32 { :controller => 'members', :action => 'create', :project_id => '5234' }
33 33 )
34 34 assert_routing(
35 35 { :method => 'post', :path => "/projects/5234/memberships.xml" },
36 36 { :controller => 'members', :action => 'create', :project_id => '5234', :format => 'xml' }
37 37 )
38 38 assert_routing(
39 { :method => 'get', :path => "/projects/5234/memberships/new" },
40 { :controller => 'members', :action => 'new', :project_id => '5234' }
41 )
42 assert_routing(
39 43 { :method => 'put', :path => "/memberships/5234" },
40 44 { :controller => 'members', :action => 'update', :id => '5234' }
41 45 )
42 46 assert_routing(
43 47 { :method => 'put', :path => "/memberships/5234.xml" },
44 48 { :controller => 'members', :action => 'update', :id => '5234', :format => 'xml' }
45 49 )
46 50 assert_routing(
47 51 { :method => 'delete', :path => "/memberships/5234" },
48 52 { :controller => 'members', :action => 'destroy', :id => '5234' }
49 53 )
50 54 assert_routing(
51 55 { :method => 'delete', :path => "/memberships/5234.xml" },
52 56 { :controller => 'members', :action => 'destroy', :id => '5234', :format => 'xml' }
53 57 )
54 58 assert_routing(
55 59 { :method => 'get', :path => "/projects/5234/memberships/autocomplete" },
56 60 { :controller => 'members', :action => 'autocomplete', :project_id => '5234' }
57 61 )
58 62 assert_routing(
59 63 { :method => 'get', :path => "/projects/5234/memberships/autocomplete.js" },
60 64 { :controller => 'members', :action => 'autocomplete', :project_id => '5234', :format => 'js' }
61 65 )
62 66 end
63 67 end
@@ -1,56 +1,66
1 1 # Redmine - project management software
2 2 # Copyright (C) 2006-2014 Jean-Philippe Lang
3 3 #
4 4 # This program is free software; you can redistribute it and/or
5 5 # modify it under the terms of the GNU General Public License
6 6 # as published by the Free Software Foundation; either version 2
7 7 # of the License, or (at your option) any later version.
8 8 #
9 9 # This program is distributed in the hope that it will be useful,
10 10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 12 # GNU General Public License for more details.
13 13 #
14 14 # You should have received a copy of the GNU General Public License
15 15 # along with this program; if not, write to the Free Software
16 16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 17
18 18 require File.expand_path('../../../test_helper', __FILE__)
19 19
20 20 class RoutingPrincipalMembershipsTest < ActionDispatch::IntegrationTest
21 21 def test_user_memberships
22 22 assert_routing(
23 { :method => 'get', :path => "/users/123/memberships/new" },
24 { :controller => 'principal_memberships', :action => 'new',
25 :user_id => '123' }
26 )
27 assert_routing(
23 28 { :method => 'post', :path => "/users/123/memberships" },
24 29 { :controller => 'principal_memberships', :action => 'create',
25 30 :user_id => '123' }
26 31 )
27 32 assert_routing(
28 33 { :method => 'put', :path => "/users/123/memberships/55" },
29 34 { :controller => 'principal_memberships', :action => 'update',
30 35 :user_id => '123', :id => '55' }
31 36 )
32 37 assert_routing(
33 38 { :method => 'delete', :path => "/users/123/memberships/55" },
34 39 { :controller => 'principal_memberships', :action => 'destroy',
35 40 :user_id => '123', :id => '55' }
36 41 )
37 42 end
38 43
39 44 def test_group_memberships
40 45 assert_routing(
46 { :method => 'get', :path => "/groups/123/memberships/new" },
47 { :controller => 'principal_memberships', :action => 'new',
48 :group_id => '123' }
49 )
50 assert_routing(
41 51 { :method => 'post', :path => "/groups/123/memberships" },
42 52 { :controller => 'principal_memberships', :action => 'create',
43 53 :group_id => '123' }
44 54 )
45 55 assert_routing(
46 56 { :method => 'put', :path => "/groups/123/memberships/55" },
47 57 { :controller => 'principal_memberships', :action => 'update',
48 58 :group_id => '123', :id => '55' }
49 59 )
50 60 assert_routing(
51 61 { :method => 'delete', :path => "/groups/123/memberships/55" },
52 62 { :controller => 'principal_memberships', :action => 'destroy',
53 63 :group_id => '123', :id => '55' }
54 64 )
55 65 end
56 66 end
General Comments 0
You need to be logged in to leave comments. Login now