annotate .svn/pristine/fb/fb7ef041bbcc8eadd98d7fb619e196b16fec91c6.svn-base @ 1519:afce8026aaeb redmine-2.4-integration

Merge from branch "live"
author Chris Cannam
date Tue, 09 Sep 2014 09:34:53 +0100
parents cbb26bc654de
children
rev   line source
Chris@909 1 require File.expand_path('../../test_helper', __FILE__)
Chris@909 2
Chris@909 3 class LayoutTest < ActionController::IntegrationTest
Chris@909 4 fixtures :projects, :trackers, :issue_statuses, :issues,
Chris@909 5 :enumerations, :users, :issue_categories,
Chris@909 6 :projects_trackers,
Chris@909 7 :roles,
Chris@909 8 :member_roles,
Chris@909 9 :members,
Chris@909 10 :enabled_modules,
Chris@909 11 :workflows
Chris@909 12
Chris@909 13 test "browsing to a missing page should render the base layout" do
Chris@909 14 get "/users/100000000"
Chris@909 15
Chris@909 16 assert_response :not_found
Chris@909 17
Chris@909 18 # UsersController uses the admin layout by default
Chris@909 19 assert_select "#admin-menu", :count => 0
Chris@909 20 end
Chris@909 21
Chris@909 22 test "browsing to an unauthorized page should render the base layout" do
Chris@909 23 change_user_password('miscuser9', 'test')
Chris@909 24
Chris@909 25 log_user('miscuser9','test')
Chris@909 26
Chris@909 27 get "/admin"
Chris@909 28 assert_response :forbidden
Chris@909 29 assert_select "#admin-menu", :count => 0
Chris@909 30 end
Chris@909 31
Chris@909 32 def test_top_menu_and_search_not_visible_when_login_required
Chris@909 33 with_settings :login_required => '1' do
Chris@909 34 get '/'
Chris@909 35 assert_select "#top-menu > ul", 0
Chris@909 36 assert_select "#quick-search", 0
Chris@909 37 end
Chris@909 38 end
Chris@909 39
Chris@909 40 def test_top_menu_and_search_visible_when_login_not_required
Chris@909 41 with_settings :login_required => '0' do
Chris@909 42 get '/'
Chris@909 43 assert_select "#top-menu > ul"
Chris@909 44 assert_select "#quick-search"
Chris@909 45 end
Chris@909 46 end
Chris@909 47
Chris@909 48 def test_wiki_formatter_header_tags
Chris@909 49 Role.anonymous.add_permission! :add_issues
Chris@909 50
Chris@909 51 get '/projects/ecookbook/issues/new'
Chris@909 52 assert_tag :script,
Chris@909 53 :attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}},
Chris@909 54 :parent => {:tag => 'head'}
Chris@909 55 end
Chris@909 56 end