summaryrefslogtreecommitdiffstats
path: root/test/integration
diff options
context:
space:
mode:
authorJean-Philippe Lang <jp_lang@yahoo.fr>2014-09-13 11:09:01 +0000
committerJean-Philippe Lang <jp_lang@yahoo.fr>2014-09-13 11:09:01 +0000
commit416ebc222db4604e1f4740189ec4d18c3c454f51 (patch)
tree4b460d4dd34b7497653a9119a02342aa87ff8c7e /test/integration
parente6761e30e514206ef2fb56faa6ce335e3d241b51 (diff)
downloadredmine-416ebc222db4604e1f4740189ec4d18c3c454f51.tar.gz
redmine-416ebc222db4604e1f4740189ec4d18c3c454f51.zip
Adds a test for default context of controller hooks (#16930).
git-svn-id: http://svn.redmine.org/redmine/trunk@13394 e93f8b46-1217-0410-a6f0-8f06a7374b81
Diffstat (limited to 'test/integration')
-rw-r--r--test/integration/lib/redmine/hook_test.rb19
1 files changed, 19 insertions, 0 deletions
diff --git a/test/integration/lib/redmine/hook_test.rb b/test/integration/lib/redmine/hook_test.rb
index e7f4d1d13..425e9610e 100644
--- a/test/integration/lib/redmine/hook_test.rb
+++ b/test/integration/lib/redmine/hook_test.rb
@@ -45,6 +45,15 @@ class HookTest < ActionController::IntegrationTest
VIEW
end
+ # Hooks that stores the call context
+ class ContextTestHook < Redmine::Hook::ViewListener
+ cattr_accessor :context
+
+ def controller_account_success_authentication_after(context)
+ self.class.context = context
+ end
+ end
+
def setup
Redmine::Hook.clear_listeners
end
@@ -86,4 +95,14 @@ VIEW
assert_select 'link[href=/plugin_assets/test_plugin/stylesheets/test_plugin.css]'
end
end
+
+ def test_controller_hook_context_should_include_request
+ Redmine::Hook.add_listener(ContextTestHook)
+ post '/login', :username => 'admin', :password => 'admin'
+ assert_not_nil ContextTestHook.context
+ context = ContextTestHook.context
+ assert_kind_of ActionDispatch::Request, context[:request]
+ assert_kind_of Hash, context[:request].params
+ assert_kind_of AccountController, context[:hook_caller]
+ end
end