##// END OF EJS Templates
Reset the default language for the test, autotest was caught it staying at :no...
Eric Davis -
r2750:677d1769d6d6
parent child
Show More
@@ -1,69 +1,70
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.dirname(__FILE__)}/../../../test_helper"
19 19
20 20 class MenuManagerTest < ActionController::IntegrationTest
21 21 include Redmine::I18n
22 22
23 23 fixtures :all
24 24
25 25 def test_project_menu_with_specific_locale
26 26 get 'projects/ecookbook/issues', { }, 'Accept-Language' => 'fr,fr-fr;q=0.8,en-us;q=0.5,en;q=0.3'
27 27
28 28 assert_tag :div, :attributes => { :id => 'main-menu' },
29 29 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_activity),
30 30 :attributes => { :href => '/projects/ecookbook/activity',
31 31 :class => 'activity' } } }
32 32 assert_tag :div, :attributes => { :id => 'main-menu' },
33 33 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => ll('fr', :label_issue_plural),
34 34 :attributes => { :href => '/projects/ecookbook/issues',
35 35 :class => 'issues selected' } } }
36 36 end
37 37
38 38 def test_project_menu_with_additional_menu_items
39 Setting.default_language = 'en'
39 40 assert_no_difference 'Redmine::MenuManager.items(:project_menu).size' do
40 41 Redmine::MenuManager.map :project_menu do |menu|
41 42 menu.push :foo, { :controller => 'projects', :action => 'show' }, :caption => 'Foo'
42 43 menu.push :bar, { :controller => 'projects', :action => 'show' }, :before => :activity
43 44 menu.push :hello, { :controller => 'projects', :action => 'show' }, :caption => Proc.new {|p| p.name.upcase }, :after => :bar
44 45 end
45 46
46 47 get 'projects/ecookbook'
47 48 assert_tag :div, :attributes => { :id => 'main-menu' },
48 49 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Foo',
49 50 :attributes => { :class => 'foo' } } }
50 51
51 52 assert_tag :div, :attributes => { :id => 'main-menu' },
52 53 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'Bar',
53 54 :attributes => { :class => 'bar' } },
54 55 :before => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK' } } }
55 56
56 57 assert_tag :div, :attributes => { :id => 'main-menu' },
57 58 :descendant => { :tag => 'li', :child => { :tag => 'a', :content => 'ECOOKBOOK',
58 59 :attributes => { :class => 'hello' } },
59 60 :before => { :tag => 'li', :child => { :tag => 'a', :content => 'Activity' } } }
60 61
61 62 # Remove the menu items
62 63 Redmine::MenuManager.map :project_menu do |menu|
63 64 menu.delete :foo
64 65 menu.delete :bar
65 66 menu.delete :hello
66 67 end
67 68 end
68 69 end
69 70 end
General Comments 0
You need to be logged in to leave comments. Login now