annotate test/integration/layout_test.rb @ 1082:997f6d7738f7 bug_531

In repo controller entry action, show the page for the file even if it's binary (so user still has access to history etc links). This makes it possible to use the entry action as the default when a file is clicked on
author Chris Cannam <chris.cannam@soundsoftware.ac.uk>
date Thu, 22 Nov 2012 18:04:17 +0000
parents cbb26bc654de
children 433d4f72a19b
rev   line source
Chris@119 1 require File.expand_path('../../test_helper', __FILE__)
Chris@14 2
Chris@14 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@14 12
Chris@14 13 test "browsing to a missing page should render the base layout" do
Chris@14 14 get "/users/100000000"
Chris@14 15
Chris@14 16 assert_response :not_found
Chris@14 17
Chris@14 18 # UsersController uses the admin layout by default
Chris@14 19 assert_select "#admin-menu", :count => 0
Chris@14 20 end
Chris@14 21
Chris@14 22 test "browsing to an unauthorized page should render the base layout" do
Chris@14 23 change_user_password('miscuser9', 'test')
Chris@909 24
Chris@14 25 log_user('miscuser9','test')
Chris@14 26
Chris@14 27 get "/admin"
Chris@14 28 assert_response :forbidden
Chris@14 29 assert_select "#admin-menu", :count => 0
Chris@14 30 end
Chris@441 31
Chris@441 32 def test_top_menu_and_search_not_visible_when_login_required
Chris@441 33 with_settings :login_required => '1' do
Chris@441 34 get '/'
Chris@441 35 assert_select "#top-menu > ul", 0
Chris@441 36 assert_select "#quick-search", 0
Chris@441 37 end
Chris@441 38 end
Chris@441 39
Chris@441 40 def test_top_menu_and_search_visible_when_login_not_required
Chris@441 41 with_settings :login_required => '0' do
Chris@441 42 get '/'
Chris@441 43 assert_select "#top-menu > ul"
Chris@441 44 assert_select "#quick-search"
Chris@441 45 end
Chris@441 46 end
Chris@909 47
Chris@441 48 def test_wiki_formatter_header_tags
Chris@441 49 Role.anonymous.add_permission! :add_issues
Chris@909 50
Chris@441 51 get '/projects/ecookbook/issues/new'
Chris@441 52 assert_tag :script,
Chris@441 53 :attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}},
Chris@441 54 :parent => {:tag => 'head'}
Chris@441 55 end
Chris@14 56 end