##// END OF EJS Templates
Adds a test for default context of controller hooks (#16930)....
Jean-Philippe Lang -
r13031:416ebc222db4
parent child
Show More
@@ -45,6 +45,15 class HookTest < ActionController::IntegrationTest
45 VIEW
45 VIEW
46 end
46 end
47
47
48 # Hooks that stores the call context
49 class ContextTestHook < Redmine::Hook::ViewListener
50 cattr_accessor :context
51
52 def controller_account_success_authentication_after(context)
53 self.class.context = context
54 end
55 end
56
48 def setup
57 def setup
49 Redmine::Hook.clear_listeners
58 Redmine::Hook.clear_listeners
50 end
59 end
@@ -86,4 +95,14 VIEW
86 assert_select 'link[href=/plugin_assets/test_plugin/stylesheets/test_plugin.css]'
95 assert_select 'link[href=/plugin_assets/test_plugin/stylesheets/test_plugin.css]'
87 end
96 end
88 end
97 end
98
99 def test_controller_hook_context_should_include_request
100 Redmine::Hook.add_listener(ContextTestHook)
101 post '/login', :username => 'admin', :password => 'admin'
102 assert_not_nil ContextTestHook.context
103 context = ContextTestHook.context
104 assert_kind_of ActionDispatch::Request, context[:request]
105 assert_kind_of Hash, context[:request].params
106 assert_kind_of AccountController, context[:hook_caller]
107 end
89 end
108 end
General Comments 0
You need to be logged in to leave comments. Login now