Mercurial > hg > soundsoftware-site
comparison .svn/pristine/84/849f87222b3ad4c6513f88d2c270ccbbefd56465.svn-base @ 1298:4f746d8966dd redmine_2.3_integration
Merge from redmine-2.3 branch to create new branch redmine-2.3-integration
author | Chris Cannam |
---|---|
date | Fri, 14 Jun 2013 09:28:30 +0100 |
parents | 622f24f53b42 |
children |
comparison
equal
deleted
inserted
replaced
1297:0a574315af3e | 1298:4f746d8966dd |
---|---|
1 # Redmine - project management software | |
2 # Copyright (C) 2006-2013 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 module RedmineMenuTestHelper | |
21 # Assertions | |
22 def assert_number_of_items_in_menu(menu_name, count) | |
23 assert Redmine::MenuManager.items(menu_name).size >= count, "Menu has less than #{count} items" | |
24 end | |
25 | |
26 def assert_menu_contains_item_named(menu_name, item_name) | |
27 assert Redmine::MenuManager.items(menu_name).collect(&:name).include?(item_name.to_sym), "Menu did not have an item named #{item_name}" | |
28 end | |
29 | |
30 # Helpers | |
31 def get_menu_item(menu_name, item_name) | |
32 Redmine::MenuManager.items(menu_name).find {|item| item.name == item_name.to_sym} | |
33 end | |
34 end | |
35 | |
36 class RedmineTest < ActiveSupport::TestCase | |
37 include RedmineMenuTestHelper | |
38 | |
39 def test_top_menu | |
40 assert_number_of_items_in_menu :top_menu, 5 | |
41 assert_menu_contains_item_named :top_menu, :home | |
42 assert_menu_contains_item_named :top_menu, :my_page | |
43 assert_menu_contains_item_named :top_menu, :projects | |
44 assert_menu_contains_item_named :top_menu, :administration | |
45 assert_menu_contains_item_named :top_menu, :help | |
46 end | |
47 | |
48 def test_account_menu | |
49 assert_number_of_items_in_menu :account_menu, 4 | |
50 assert_menu_contains_item_named :account_menu, :login | |
51 assert_menu_contains_item_named :account_menu, :register | |
52 assert_menu_contains_item_named :account_menu, :my_account | |
53 assert_menu_contains_item_named :account_menu, :logout | |
54 end | |
55 | |
56 def test_application_menu | |
57 assert_number_of_items_in_menu :application_menu, 0 | |
58 end | |
59 | |
60 def test_admin_menu | |
61 assert_number_of_items_in_menu :admin_menu, 0 | |
62 end | |
63 | |
64 def test_project_menu | |
65 assert_number_of_items_in_menu :project_menu, 14 | |
66 assert_menu_contains_item_named :project_menu, :overview | |
67 assert_menu_contains_item_named :project_menu, :activity | |
68 assert_menu_contains_item_named :project_menu, :roadmap | |
69 assert_menu_contains_item_named :project_menu, :issues | |
70 assert_menu_contains_item_named :project_menu, :new_issue | |
71 assert_menu_contains_item_named :project_menu, :calendar | |
72 assert_menu_contains_item_named :project_menu, :gantt | |
73 assert_menu_contains_item_named :project_menu, :news | |
74 assert_menu_contains_item_named :project_menu, :documents | |
75 assert_menu_contains_item_named :project_menu, :wiki | |
76 assert_menu_contains_item_named :project_menu, :boards | |
77 assert_menu_contains_item_named :project_menu, :files | |
78 assert_menu_contains_item_named :project_menu, :repository | |
79 assert_menu_contains_item_named :project_menu, :settings | |
80 end | |
81 | |
82 def test_new_issue_should_have_root_as_a_parent | |
83 new_issue = get_menu_item(:project_menu, :new_issue) | |
84 assert_equal :root, new_issue.parent.name | |
85 end | |
86 end |