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 / 8e / 8e360828b7559a0bf382d3c9703cd8bcdd40469c.svn-base @ 1297:0a574315af3e

History | View | Annotate | Download (4.45 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 RoutingVersionsTest < ActionController::IntegrationTest
21
  def test_roadmap
22
    # /projects/foo/versions is /projects/foo/roadmap
23
    assert_routing(
24
        { :method => 'get', :path => "/projects/33/roadmap" },
25
        { :controller => 'versions', :action => 'index', :project_id => '33' }
26
      )
27
  end
28
29
  def test_versions_scoped_under_project
30
    assert_routing(
31
        { :method => 'put', :path => "/projects/foo/versions/close_completed" },
32
        { :controller => 'versions', :action => 'close_completed',
33
          :project_id => 'foo' }
34
      )
35
    assert_routing(
36
        { :method => 'get', :path => "/projects/foo/versions.xml" },
37
        { :controller => 'versions', :action => 'index',
38
          :project_id => 'foo', :format => 'xml' }
39
      )
40
    assert_routing(
41
        { :method => 'get', :path => "/projects/foo/versions.json" },
42
        { :controller => 'versions', :action => 'index',
43
          :project_id => 'foo', :format => 'json' }
44
      )
45
    assert_routing(
46
        { :method => 'get', :path => "/projects/foo/versions/new" },
47
        { :controller => 'versions', :action => 'new',
48
          :project_id => 'foo' }
49
      )
50
    assert_routing(
51
        { :method => 'post', :path => "/projects/foo/versions" },
52
        { :controller => 'versions', :action => 'create',
53
          :project_id => 'foo' }
54
      )
55
    assert_routing(
56
        { :method => 'post', :path => "/projects/foo/versions.xml" },
57
        { :controller => 'versions', :action => 'create',
58
          :project_id => 'foo', :format => 'xml' }
59
      )
60
    assert_routing(
61
        { :method => 'post', :path => "/projects/foo/versions.json" },
62
        { :controller => 'versions', :action => 'create',
63
          :project_id => 'foo', :format => 'json' }
64
      )
65
  end
66
67
  def test_versions
68
    assert_routing(
69
        { :method => 'get', :path => "/versions/1" },
70
        { :controller => 'versions', :action => 'show', :id => '1' }
71
      )
72
    assert_routing(
73
        { :method => 'get', :path => "/versions/1.xml" },
74
        { :controller => 'versions', :action => 'show', :id => '1',
75
          :format => 'xml' }
76
      )
77
    assert_routing(
78
        { :method => 'get', :path => "/versions/1.json" },
79
        { :controller => 'versions', :action => 'show', :id => '1',
80
          :format => 'json' }
81
      )
82
    assert_routing(
83
        { :method => 'get', :path => "/versions/1/edit" },
84
        { :controller => 'versions', :action => 'edit', :id => '1' }
85
      )
86
    assert_routing(
87
        { :method => 'put', :path => "/versions/1" },
88
        { :controller => 'versions', :action => 'update', :id => '1' }
89
      )
90
    assert_routing(
91
        { :method => 'put', :path => "/versions/1.xml" },
92
        { :controller => 'versions', :action => 'update', :id => '1',
93
          :format => 'xml' }
94
      )
95
    assert_routing(
96
        { :method => 'put', :path => "/versions/1.json" },
97
        { :controller => 'versions', :action => 'update', :id => '1',
98
          :format => 'json' }
99
      )
100
    assert_routing(
101
        { :method => 'delete', :path => "/versions/1" },
102
        { :controller => 'versions', :action => 'destroy', :id => '1' }
103
      )
104
    assert_routing(
105
        { :method => 'delete', :path => "/versions/1.xml" },
106
        { :controller => 'versions', :action => 'destroy', :id => '1',
107
          :format => 'xml' }
108
      )
109
    assert_routing(
110
        { :method => 'delete', :path => "/versions/1.json" },
111
        { :controller => 'versions', :action => 'destroy', :id => '1',
112
          :format => 'json' }
113
      )
114
    assert_routing(
115
        { :method => 'post', :path => "/versions/1/status_by" },
116
        { :controller => 'versions', :action => 'status_by', :id => '1' }
117
      )
118
  end
119
end