To check out this repository please hg clone the following URL, or open the URL using EasyMercurial or your preferred Mercurial client.
root / .svn / pristine / 24 / 24ef36c7147955d3fac8e868fb99fab632f24089.svn-base @ 1297:0a574315af3e
History | View | Annotate | Download (3.14 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 LayoutTest < ActionController::IntegrationTest |
||
| 21 | fixtures :projects, :trackers, :issue_statuses, :issues, |
||
| 22 | :enumerations, :users, :issue_categories, |
||
| 23 | :projects_trackers, |
||
| 24 | :roles, |
||
| 25 | :member_roles, |
||
| 26 | :members, |
||
| 27 | :enabled_modules, |
||
| 28 | :workflows |
||
| 29 | |||
| 30 | test "browsing to a missing page should render the base layout" do |
||
| 31 | get "/users/100000000" |
||
| 32 | |||
| 33 | assert_response :not_found |
||
| 34 | |||
| 35 | # UsersController uses the admin layout by default |
||
| 36 | assert_select "#admin-menu", :count => 0 |
||
| 37 | end |
||
| 38 | |||
| 39 | test "browsing to an unauthorized page should render the base layout" do |
||
| 40 | change_user_password('miscuser9', 'test1234')
|
||
| 41 | |||
| 42 | log_user('miscuser9','test1234')
|
||
| 43 | |||
| 44 | get "/admin" |
||
| 45 | assert_response :forbidden |
||
| 46 | assert_select "#admin-menu", :count => 0 |
||
| 47 | end |
||
| 48 | |||
| 49 | def test_top_menu_and_search_not_visible_when_login_required |
||
| 50 | with_settings :login_required => '1' do |
||
| 51 | get '/' |
||
| 52 | assert_select "#top-menu > ul", 0 |
||
| 53 | assert_select "#quick-search", 0 |
||
| 54 | end |
||
| 55 | end |
||
| 56 | |||
| 57 | def test_top_menu_and_search_visible_when_login_not_required |
||
| 58 | with_settings :login_required => '0' do |
||
| 59 | get '/' |
||
| 60 | assert_select "#top-menu > ul" |
||
| 61 | assert_select "#quick-search" |
||
| 62 | end |
||
| 63 | end |
||
| 64 | |||
| 65 | def test_wiki_formatter_header_tags |
||
| 66 | Role.anonymous.add_permission! :add_issues |
||
| 67 | |||
| 68 | get '/projects/ecookbook/issues/new' |
||
| 69 | assert_tag :script, |
||
| 70 | :attributes => {:src => %r{^/javascripts/jstoolbar/jstoolbar-textile.min.js}},
|
||
| 71 | :parent => {:tag => 'head'}
|
||
| 72 | end |
||
| 73 | |||
| 74 | def test_calendar_header_tags |
||
| 75 | with_settings :default_language => 'fr' do |
||
| 76 | get '/issues' |
||
| 77 | assert_include "/javascripts/i18n/jquery.ui.datepicker-fr.js", response.body |
||
| 78 | end |
||
| 79 | |||
| 80 | with_settings :default_language => 'en-GB' do |
||
| 81 | get '/issues' |
||
| 82 | assert_include "/javascripts/i18n/jquery.ui.datepicker-en-GB.js", response.body |
||
| 83 | end |
||
| 84 | |||
| 85 | with_settings :default_language => 'en' do |
||
| 86 | get '/issues' |
||
| 87 | assert_not_include "/javascripts/i18n/jquery.ui.datepicker", response.body |
||
| 88 | end |
||
| 89 | end |
||
| 90 | |||
| 91 | def test_search_field_outside_project_should_link_to_global_search |
||
| 92 | get '/' |
||
| 93 | assert_select 'div#quick-search form[action=/search]' |
||
| 94 | end |
||
| 95 | |||
| 96 | def test_search_field_inside_project_should_link_to_project_search |
||
| 97 | get '/projects/ecookbook' |
||
| 98 | assert_select 'div#quick-search form[action=/projects/ecookbook/search]' |
||
| 99 | end |
||
| 100 | end |