From f7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2 Mon Sep 17 00:00:00 2001 From: Jean-Philippe Lang Date: Fri, 5 Sep 2008 10:31:06 +0000 Subject: Merged hooks branch @ r1785 into trunk. git-svn-id: http://redmine.rubyforge.org/svn/trunk@1786 e93f8b46-1217-0410-a6f0-8f06a7374b81 --- test/functional/projects_controller_test.rb | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) (limited to 'test/functional/projects_controller_test.rb') diff --git a/test/functional/projects_controller_test.rb b/test/functional/projects_controller_test.rb index 03773ccdb..8e57dc5fd 100644 --- a/test/functional/projects_controller_test.rb +++ b/test/functional/projects_controller_test.rb @@ -316,4 +316,23 @@ class ProjectsControllerTest < Test::Unit::TestCase end end end + + # A hook that is manually registered later + class ProjectBasedTemplate < Redmine::Hook::ViewListener + def view_layouts_base_html_head(context) + # Adds a project stylesheet + stylesheet_link_tag(context[:project].identifier) if context[:project] + end + end + # Don't use this hook now + Redmine::Hook.clear_listeners + + def test_hook_response + Redmine::Hook.add_listener(ProjectBasedTemplate) + get :show, :id => 1 + assert_tag :tag => 'link', :attributes => {:href => '/stylesheets/ecookbook.css'}, + :parent => {:tag => 'head'} + + Redmine::Hook.clear_listeners + end end -- cgit v1.2.3