@@ -1,68 +1,68 | |||
|
1 | 1 | # Redmine - project management software |
|
2 | 2 | # Copyright (C) 2006-2009 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 |
class ProjectsHelperTest < |
|
|
20 | class ProjectsHelperTest < ActionView::TestCase | |
|
21 | 21 | include ApplicationHelper |
|
22 | 22 | include ProjectsHelper |
|
23 | 23 | |
|
24 | 24 | fixtures :all |
|
25 | 25 | |
|
26 | 26 | def setup |
|
27 | 27 | super |
|
28 | 28 | set_language_if_valid('en') |
|
29 | 29 | User.current = nil |
|
30 | 30 | end |
|
31 | 31 | |
|
32 | 32 | def test_link_to_version_within_project |
|
33 | 33 | @project = Project.find(2) |
|
34 | 34 | User.current = User.find(1) |
|
35 | 35 | assert_equal '<a href="/versions/show/5">Alpha</a>', link_to_version(Version.find(5)) |
|
36 | 36 | end |
|
37 | 37 | |
|
38 | 38 | def test_link_to_version |
|
39 | 39 | User.current = User.find(1) |
|
40 | 40 | assert_equal '<a href="/versions/show/5">OnlineStore - Alpha</a>', link_to_version(Version.find(5)) |
|
41 | 41 | end |
|
42 | 42 | |
|
43 | 43 | def test_link_to_private_version |
|
44 | 44 | assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5)) |
|
45 | 45 | end |
|
46 | 46 | |
|
47 | 47 | def test_link_to_version_invalid_version |
|
48 | 48 | assert_equal '', link_to_version(Object) |
|
49 | 49 | end |
|
50 | 50 | |
|
51 | 51 | def test_format_version_name_within_project |
|
52 | 52 | @project = Project.find(1) |
|
53 | 53 | assert_equal "0.1", format_version_name(Version.find(1)) |
|
54 | 54 | end |
|
55 | 55 | |
|
56 | 56 | def test_format_version_name |
|
57 | 57 | assert_equal "eCookbook - 0.1", format_version_name(Version.find(1)) |
|
58 | 58 | end |
|
59 | 59 | |
|
60 | 60 | def test_format_version_name_for_system_version |
|
61 | 61 | assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7)) |
|
62 | 62 | end |
|
63 | 63 | |
|
64 | 64 | def test_version_options_for_select_with_no_versions |
|
65 | 65 | assert_equal '', version_options_for_select([]) |
|
66 | 66 | assert_equal '<option value="1" selected="selected">0.1</option>', version_options_for_select([], Version.find(1)) |
|
67 | 67 | end |
|
68 | 68 | end |
General Comments 0
You need to be logged in to leave comments.
Login now