2011-10-29 16:19:11 +04:00
|
|
|
#-- encoding: UTF-8
|
2011-05-30 00:11:52 +04:00
|
|
|
#-- copyright
|
|
|
|
# ChiliProject is a project management system.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# Copyright (C) 2010-2011 the ChiliProject Team
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# This program is free software; you can redistribute it and/or
|
|
|
|
# modify it under the terms of the GNU General Public License
|
|
|
|
# as published by the Free Software Foundation; either version 2
|
|
|
|
# of the License, or (at your option) any later version.
|
2011-05-30 22:52:25 +04:00
|
|
|
#
|
2011-05-30 00:11:52 +04:00
|
|
|
# See doc/COPYRIGHT.rdoc for more details.
|
|
|
|
#++
|
|
|
|
|
2010-12-13 02:24:34 +03:00
|
|
|
require File.expand_path('../../test_helper', __FILE__)
|
2010-08-19 05:01:35 +04:00
|
|
|
|
|
|
|
class LayoutTest < ActionController::IntegrationTest
|
|
|
|
fixtures :all
|
|
|
|
|
|
|
|
test "browsing to a missing page should render the base layout" do
|
|
|
|
get "/users/100000000"
|
|
|
|
|
|
|
|
assert_response :not_found
|
|
|
|
|
|
|
|
# UsersController uses the admin layout by default
|
2011-10-06 13:40:45 +04:00
|
|
|
assert_select "#main-menu", :count => 0
|
2010-08-19 05:01:35 +04:00
|
|
|
end
|
|
|
|
|
|
|
|
test "browsing to an unauthorized page should render the base layout" do
|
2010-08-19 05:28:33 +04:00
|
|
|
change_user_password('miscuser9', 'test')
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2010-08-19 05:01:35 +04:00
|
|
|
log_user('miscuser9','test')
|
|
|
|
|
|
|
|
get "/admin"
|
|
|
|
assert_response :forbidden
|
2011-10-06 13:40:45 +04:00
|
|
|
assert_select "#main-menu", :count => 0
|
2010-08-19 05:01:35 +04:00
|
|
|
end
|
2011-03-04 18:14:24 +03:00
|
|
|
|
2011-11-07 05:46:31 +04:00
|
|
|
def test_top_menu_navigation_not_visible_when_login_required
|
2011-03-04 18:14:24 +03:00
|
|
|
with_settings :login_required => '1' do
|
|
|
|
get '/'
|
2011-11-07 05:46:31 +04:00
|
|
|
assert_select "#account-nav", 0
|
2011-03-04 18:14:24 +03:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2011-11-07 05:46:31 +04:00
|
|
|
def test_top_menu_navigation_visible_when_login_not_required
|
2011-03-04 18:14:24 +03:00
|
|
|
with_settings :login_required => '0' do
|
|
|
|
get '/'
|
2011-11-07 05:46:31 +04:00
|
|
|
assert_select "#account-nav"
|
2011-03-04 18:14:24 +03:00
|
|
|
end
|
|
|
|
end
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2011-03-28 23:56:22 +04:00
|
|
|
def test_wiki_formatter_header_tags
|
|
|
|
Role.anonymous.add_permission! :add_issues
|
2011-05-30 22:52:25 +04:00
|
|
|
|
2011-03-28 23:56:22 +04:00
|
|
|
get '/projects/ecookbook/issues/new'
|
|
|
|
assert_tag :script,
|
|
|
|
:attributes => {:src => %r{^/javascripts/jstoolbar/textile.js}},
|
|
|
|
:parent => {:tag => 'head'}
|
|
|
|
end
|
2011-11-27 20:01:46 +04:00
|
|
|
|
|
|
|
test "page titles should be properly escaped" do
|
|
|
|
project = Project.generate(:name => "C&A")
|
|
|
|
|
|
|
|
with_settings :app_title => '<3' do
|
|
|
|
get "/projects/#{project.to_param}"
|
|
|
|
|
|
|
|
assert_select "title", /C&A/
|
|
|
|
assert_select "title", /<3/
|
|
|
|
end
|
|
|
|
end
|
2010-08-19 05:01:35 +04:00
|
|
|
end
|