annotate test/integration/layout_test.rb @ 1452:d6b9fd02bb89 feature_36_js_refactoring

Deprecated develoment branch.
author luisf <luis.figueira@eecs.qmul.ac.uk>
date Fri, 11 Oct 2013 17:01:24 +0100
parents cbce1fd3b1b7
children cbb26bc654de
rev   line source
Chris@119 1 require File.expand_path('../../test_helper', __FILE__)
Chris@14 2
Chris@14 3 class LayoutTest < ActionController::IntegrationTest
Chris@14 4 fixtures :all
Chris@14 5
Chris@14 6 test "browsing to a missing page should render the base layout" do
Chris@14 7 get "/users/100000000"
Chris@14 8
Chris@14 9 assert_response :not_found
Chris@14 10
Chris@14 11 # UsersController uses the admin layout by default
Chris@14 12 assert_select "#admin-menu", :count => 0
Chris@14 13 end
Chris@14 14
Chris@14 15 test "browsing to an unauthorized page should render the base layout" do
Chris@14 16 change_user_password('miscuser9', 'test')
Chris@14 17
Chris@14 18 log_user('miscuser9','test')
Chris@14 19
Chris@14 20 get "/admin"
Chris@14 21 assert_response :forbidden
Chris@14 22 assert_select "#admin-menu", :count => 0
Chris@14 23 end
Chris@441 24
Chris@441 25 def test_top_menu_and_search_not_visible_when_login_required
Chris@441 26 with_settings :login_required => '1' do
Chris@441 27 get '/'
Chris@441 28 assert_select "#top-menu > ul", 0
Chris@441 29 assert_select "#quick-search", 0
Chris@441 30 end
Chris@441 31 end
Chris@441 32
Chris@441 33 def test_top_menu_and_search_visible_when_login_not_required
Chris@441 34 with_settings :login_required => '0' do
Chris@441 35 get '/'
Chris@441 36 assert_select "#top-menu > ul"
Chris@441 37 assert_select "#quick-search"
Chris@441 38 end
Chris@441 39 end
Chris@441 40
Chris@441 41 def test_wiki_formatter_header_tags
Chris@441 42 Role.anonymous.add_permission! :add_issues
Chris@441 43
Chris@441 44 get '/projects/ecookbook/issues/new'
Chris@441 45 assert_tag :script,
Chris@441 46 :attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}},
Chris@441 47 :parent => {:tag => 'head'}
Chris@441 48 end
Chris@14 49 end