summaryrefslogtreecommitdiffstats
path: root/test/integration/lib
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-09 09:19:15 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2012-06-09 09:19:15 +0000
commitd21bacb01de0f4ebbac72dfb98c541d7ba9401ac (patch)
tree0b3011b8b79ab91695e697361762fd6b54d89294 /test/integration/lib
parent8b381e3bd4ec47091dafa480fd34eba761a25f19 (diff)
downloadredmine-d21bacb01de0f4ebbac72dfb98c541d7ba9401ac.tar.gz
redmine-d21bacb01de0f4ebbac72dfb98c541d7ba9401ac.zip
Fixed that content_for does not work in Hook.render_on (#11105).
git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@9785 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration/lib')
-rw-r--r--test/integration/lib/redmine/hook_test.rb23
1 files changed, 23 insertions, 0 deletions
diff --git a/test/integration/lib/redmine/hook_test.rb b/test/integration/lib/redmine/hook_test.rb
index bbea0e643..790ae6a52 100644
--- a/test/integration/lib/redmine/hook_test.rb
+++ b/test/integration/lib/redmine/hook_test.rb
@@ -35,6 +35,17 @@ class MenuManagerTest < ActionController::IntegrationTest
end
end
+ class ContentForInsideHook < Redmine::Hook::ViewListener
+ render_on :view_welcome_index_left, :inline => <<-VIEW
+<% content_for :header_tags do %>
+ <%= javascript_include_tag 'test_plugin.js', :plugin => 'test_plugin' %>
+ <%= stylesheet_link_tag 'test_plugin.css', :plugin => 'test_plugin' %>
+<% end %>
+
+<p>ContentForInsideHook content</p>
+VIEW
+ end
+
def setup
Redmine::Hook.clear_listeners
end
@@ -64,4 +75,16 @@ class MenuManagerTest < ActionController::IntegrationTest
assert_select 'div#main'
assert_select 'div#main.nosidebar', 0
end
+
+ def test_hook_with_content_for_should_append_content
+ Redmine::Hook.add_listener(ContentForInsideHook)
+
+ get '/'
+ assert_response :success
+ assert_select 'p', :text => 'ContentForInsideHook content'
+ assert_select 'head' do
+ assert_select 'script[src=/plugin_assets/test_plugin/javascripts/test_plugin.js]'
+ assert_select 'link[href=/plugin_assets/test_plugin/stylesheets/test_plugin.css]'
+ end
+ end
end