summaryrefslogtreecommitdiffstats
path: root/test/functional/projects_controller_test.rb
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-05 10:31:06 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2008-09-05 10:31:06 +0000
commitf7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2 (patch)
treeba4070526883885914942b3a0d253eb2a6e63bf8 /test/functional/projects_controller_test.rb
parent4b9df2eac774aa045aa5207c8bc613ed6ca67d42 (diff)
downloadredmine-f7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2.tar.gz
redmine-f7acdd1afde3018a9f7c0a7dc3b6bd97a65670a2.zip
Merged hooks branch @ r1785 into trunk.
git-svn-id: http://redmine.rubyforge.org/svn/trunk@1786 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/functional/projects_controller_test.rb')
-rw-r--r--test/functional/projects_controller_test.rb19
1 files changed, 19 insertions, 0 deletions
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