@@ -46,10 +46,15 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
46 | 46 | end |
|
47 | 47 | end |
|
48 | 48 | |
|
49 | class TestHookHelperController < ActionController::Base | |
|
50 | include Redmine::Hook::Helper | |
|
51 | end | |
|
52 | ||
|
49 | 53 | Redmine::Hook.clear_listeners |
|
50 | 54 | |
|
51 | 55 | def setup |
|
52 | 56 | @hook_module = Redmine::Hook |
|
57 | @hook_helper = TestHookHelperController.new | |
|
53 | 58 | end |
|
54 | 59 | |
|
55 | 60 | def teardown |
@@ -75,18 +80,19 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
75 | 80 | |
|
76 | 81 | def test_call_hook |
|
77 | 82 | @hook_module.add_listener(TestHook1) |
|
78 |
assert_equal ['Test hook 1 listener.'], @hook_ |
|
|
83 | assert_equal ['Test hook 1 listener.'], @hook_helper.call_hook(:view_layouts_base_html_head) | |
|
79 | 84 | end |
|
80 | 85 | |
|
81 | 86 | def test_call_hook_with_context |
|
82 | 87 | @hook_module.add_listener(TestHook3) |
|
83 | assert_equal ['Context keys: bar, foo.'], @hook_module.call_hook(:view_layouts_base_html_head, :foo => 1, :bar => 'a') | |
|
88 | assert_equal ['Context keys: bar, controller, foo, project, request.'], | |
|
89 | @hook_helper.call_hook(:view_layouts_base_html_head, :foo => 1, :bar => 'a') | |
|
84 | 90 | end |
|
85 | 91 | |
|
86 | 92 | def test_call_hook_with_multiple_listeners |
|
87 | 93 | @hook_module.add_listener(TestHook1) |
|
88 | 94 | @hook_module.add_listener(TestHook2) |
|
89 |
assert_equal ['Test hook 1 listener.', 'Test hook 2 listener.'], @hook_ |
|
|
95 | assert_equal ['Test hook 1 listener.', 'Test hook 2 listener.'], @hook_helper.call_hook(:view_layouts_base_html_head) | |
|
90 | 96 | end |
|
91 | 97 | |
|
92 | 98 | # Context: Redmine::Hook::call_hook |
@@ -96,7 +102,7 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
96 | 102 | @hook_module.add_listener(TestLinkToHook) |
|
97 | 103 | |
|
98 | 104 | assert_equal ['<a href="http://example.com/issues">Issues</a>'], |
|
99 |
@hook_ |
|
|
105 | @hook_helper.call_hook(:view_layouts_base_html_head, :request => request) | |
|
100 | 106 | end |
|
101 | 107 | |
|
102 | 108 | def test_call_hook_default_url_options_set_with_no_standard_request_port |
@@ -105,7 +111,7 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
105 | 111 | @hook_module.add_listener(TestLinkToHook) |
|
106 | 112 | |
|
107 | 113 | assert_equal ['<a href="http://example.com:3000/issues">Issues</a>'], |
|
108 |
@hook_ |
|
|
114 | @hook_helper.call_hook(:view_layouts_base_html_head, :request => request) | |
|
109 | 115 | end |
|
110 | 116 | |
|
111 | 117 | def test_call_hook_default_url_options_set_with_ssl |
@@ -114,7 +120,7 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
114 | 120 | @hook_module.add_listener(TestLinkToHook) |
|
115 | 121 | |
|
116 | 122 | assert_equal ['<a href="https://example.com/issues">Issues</a>'], |
|
117 |
@hook_ |
|
|
123 | @hook_helper.call_hook(:view_layouts_base_html_head, :request => request) | |
|
118 | 124 | end |
|
119 | 125 | |
|
120 | 126 | def test_call_hook_default_url_options_set_with_forwarded_ssl |
@@ -123,7 +129,7 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
123 | 129 | @hook_module.add_listener(TestLinkToHook) |
|
124 | 130 | |
|
125 | 131 | assert_equal ['<a href="https://example.com/issues">Issues</a>'], |
|
126 |
@hook_ |
|
|
132 | @hook_helper.call_hook(:view_layouts_base_html_head, :request => request) | |
|
127 | 133 | end |
|
128 | 134 | |
|
129 | 135 | # Context: Redmine::Hook::Helper.call_hook |
General Comments 0
You need to be logged in to leave comments.
Login now