##// END OF EJS Templates
Rails3: replace "all" fixtures at test/unit/helpers/projects_helper_test.rb...
Toshi MARUYAMA -
r7363:12813cd6ab58
parent child
Show More
@@ -1,68 +1,76
1 # Redmine - project management software
1 # Redmine - project management software
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
2 # Copyright (C) 2006-2011 Jean-Philippe Lang
3 #
3 #
4 # This program is free software; you can redistribute it and/or
4 # This program is free software; you can redistribute it and/or
5 # modify it under the terms of the GNU General Public License
5 # modify it under the terms of the GNU General Public License
6 # as published by the Free Software Foundation; either version 2
6 # as published by the Free Software Foundation; either version 2
7 # of the License, or (at your option) any later version.
7 # of the License, or (at your option) any later version.
8 #
8 #
9 # This program is distributed in the hope that it will be useful,
9 # This program is distributed in the hope that it will be useful,
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
10 # but WITHOUT ANY WARRANTY; without even the implied warranty of
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 # GNU General Public License for more details.
12 # GNU General Public License for more details.
13 #
13 #
14 # You should have received a copy of the GNU General Public License
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
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.
16 # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17
17
18 require File.expand_path('../../../test_helper', __FILE__)
18 require File.expand_path('../../../test_helper', __FILE__)
19
19
20 class ProjectsHelperTest < ActionView::TestCase
20 class ProjectsHelperTest < ActionView::TestCase
21 include ApplicationHelper
21 include ApplicationHelper
22 include ProjectsHelper
22 include ProjectsHelper
23
23
24 fixtures :all
24 fixtures :projects, :trackers, :issue_statuses, :issues,
25 :enumerations, :users, :issue_categories,
26 :versions,
27 :projects_trackers,
28 :member_roles,
29 :members,
30 :groups_users,
31 :enabled_modules,
32 :workflows
25
33
26 def setup
34 def setup
27 super
35 super
28 set_language_if_valid('en')
36 set_language_if_valid('en')
29 User.current = nil
37 User.current = nil
30 end
38 end
31
39
32 def test_link_to_version_within_project
40 def test_link_to_version_within_project
33 @project = Project.find(2)
41 @project = Project.find(2)
34 User.current = User.find(1)
42 User.current = User.find(1)
35 assert_equal '<a href="/versions/5">Alpha</a>', link_to_version(Version.find(5))
43 assert_equal '<a href="/versions/5">Alpha</a>', link_to_version(Version.find(5))
36 end
44 end
37
45
38 def test_link_to_version
46 def test_link_to_version
39 User.current = User.find(1)
47 User.current = User.find(1)
40 assert_equal '<a href="/versions/5">OnlineStore - Alpha</a>', link_to_version(Version.find(5))
48 assert_equal '<a href="/versions/5">OnlineStore - Alpha</a>', link_to_version(Version.find(5))
41 end
49 end
42
50
43 def test_link_to_private_version
51 def test_link_to_private_version
44 assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5))
52 assert_equal 'OnlineStore - Alpha', link_to_version(Version.find(5))
45 end
53 end
46
54
47 def test_link_to_version_invalid_version
55 def test_link_to_version_invalid_version
48 assert_equal '', link_to_version(Object)
56 assert_equal '', link_to_version(Object)
49 end
57 end
50
58
51 def test_format_version_name_within_project
59 def test_format_version_name_within_project
52 @project = Project.find(1)
60 @project = Project.find(1)
53 assert_equal "0.1", format_version_name(Version.find(1))
61 assert_equal "0.1", format_version_name(Version.find(1))
54 end
62 end
55
63
56 def test_format_version_name
64 def test_format_version_name
57 assert_equal "eCookbook - 0.1", format_version_name(Version.find(1))
65 assert_equal "eCookbook - 0.1", format_version_name(Version.find(1))
58 end
66 end
59
67
60 def test_format_version_name_for_system_version
68 def test_format_version_name_for_system_version
61 assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7))
69 assert_equal "OnlineStore - Systemwide visible version", format_version_name(Version.find(7))
62 end
70 end
63
71
64 def test_version_options_for_select_with_no_versions
72 def test_version_options_for_select_with_no_versions
65 assert_equal '', version_options_for_select([])
73 assert_equal '', version_options_for_select([])
66 assert_equal '<option value="1" selected="selected">0.1</option>', version_options_for_select([], Version.find(1))
74 assert_equal '<option value="1" selected="selected">0.1</option>', version_options_for_select([], Version.find(1))
67 end
75 end
68 end
76 end
General Comments 0
You need to be logged in to leave comments. Login now