To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.

Statistics Download as Zip
| Branch: | Tag: | Revision:

root / .svn / pristine / 5a / 5a1840fc054d28e77ff1b94fc4244d3b1cc2bcb1.svn-base @ 1297:0a574315af3e

History | View | Annotate | Download (4.01 KB)

1 1296:038ba2d95de8 Chris
# 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 RoutingGroupsTest < ActionController::IntegrationTest
21
  def test_groups_resources
22
    assert_routing(
23
        { :method => 'get', :path => "/groups" },
24
        { :controller => 'groups', :action => 'index' }
25
      )
26
    assert_routing(
27
        { :method => 'get', :path => "/groups.xml" },
28
        { :controller => 'groups', :action => 'index', :format => 'xml' }
29
      )
30
    assert_routing(
31
        { :method => 'post', :path => "/groups" },
32
        { :controller => 'groups', :action => 'create' }
33
      )
34
    assert_routing(
35
        { :method => 'post', :path => "/groups.xml" },
36
        { :controller => 'groups', :action => 'create', :format => 'xml' }
37
      )
38
    assert_routing(
39
        { :method => 'get', :path => "/groups/new" },
40
        { :controller => 'groups', :action => 'new' }
41
      )
42
    assert_routing(
43
        { :method => 'get', :path => "/groups/1/edit" },
44
        { :controller => 'groups', :action => 'edit', :id => '1' }
45
      )
46
    assert_routing(
47
        { :method => 'get', :path => "/groups/1/autocomplete_for_user" },
48
        { :controller => 'groups', :action => 'autocomplete_for_user', :id => '1' }
49
      )
50
    assert_routing(
51
        { :method => 'get', :path => "/groups/1" },
52
        { :controller => 'groups', :action => 'show', :id => '1' }
53
      )
54
    assert_routing(
55
        { :method => 'get', :path => "/groups/1.xml" },
56
        { :controller => 'groups', :action => 'show', :id => '1', :format => 'xml' }
57
      )
58
    assert_routing(
59
        { :method => 'put', :path => "/groups/1" },
60
        { :controller => 'groups', :action => 'update', :id => '1' }
61
      )
62
    assert_routing(
63
        { :method => 'put', :path => "/groups/1.xml" },
64
        { :controller => 'groups', :action => 'update', :id => '1', :format => 'xml' }
65
      )
66
    assert_routing(
67
        { :method => 'delete', :path => "/groups/1" },
68
        { :controller => 'groups', :action => 'destroy', :id => '1' }
69
      )
70
    assert_routing(
71
        { :method => 'delete', :path => "/groups/1.xml" },
72
        { :controller => 'groups', :action => 'destroy', :id => '1', :format => 'xml' }
73
      )
74
  end
75
76
  def test_groups
77
    assert_routing(
78
        { :method => 'post', :path => "/groups/567/users" },
79
        { :controller => 'groups', :action => 'add_users', :id => '567' }
80
      )
81
    assert_routing(
82
        { :method => 'post', :path => "/groups/567/users.xml" },
83
        { :controller => 'groups', :action => 'add_users', :id => '567', :format => 'xml' }
84
      )
85
    assert_routing(
86
        { :method => 'delete', :path => "/groups/567/users/12" },
87
        { :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12' }
88
      )
89
    assert_routing(
90
        { :method => 'delete', :path => "/groups/567/users/12.xml" },
91
        { :controller => 'groups', :action => 'remove_user', :id => '567', :user_id => '12', :format => 'xml' }
92
      )
93
    assert_routing(
94
        { :method => 'post', :path => "/groups/destroy_membership/567" },
95
        { :controller => 'groups', :action => 'destroy_membership', :id => '567' }
96
      )
97
    assert_routing(
98
        { :method => 'post', :path => "/groups/edit_membership/567" },
99
        { :controller => 'groups', :action => 'edit_membership', :id => '567' }
100
      )
101
  end
102
end