@@ -50,11 +50,16 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
50 | 50 | include Redmine::Hook::Helper |
|
51 | 51 | end |
|
52 | 52 | |
|
53 | class TestHookHelperView < ActionView::Base | |
|
54 | include Redmine::Hook::Helper | |
|
55 | end | |
|
56 | ||
|
53 | 57 | Redmine::Hook.clear_listeners |
|
54 | 58 | |
|
55 | 59 | def setup |
|
56 | 60 | @hook_module = Redmine::Hook |
|
57 | 61 | @hook_helper = TestHookHelperController.new |
|
62 | @view_hook_helper = TestHookHelperView.new(RAILS_ROOT + '/app/views') | |
|
58 | 63 | end |
|
59 | 64 | |
|
60 | 65 | def teardown |
@@ -134,31 +139,40 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||
|
134 | 139 | |
|
135 | 140 | # Context: Redmine::Hook::Helper.call_hook |
|
136 | 141 | def test_call_hook_with_project_added_to_context |
|
137 | # TODO: Implement test | |
|
142 | @hook_module.add_listener(TestHook3) | |
|
143 | assert_match /project/i, @hook_helper.call_hook(:view_layouts_base_html_head)[0] | |
|
138 | 144 | end |
|
139 | 145 | |
|
140 | 146 | def test_call_hook_from_controller_with_controller_added_to_context |
|
141 | # TODO: Implement test | |
|
147 | @hook_module.add_listener(TestHook3) | |
|
148 | assert_match /controller/i, @hook_helper.call_hook(:view_layouts_base_html_head)[0] | |
|
142 | 149 | end |
|
143 | 150 | |
|
144 | 151 | def test_call_hook_from_controller_with_request_added_to_context |
|
145 | # TODO: Implement test | |
|
152 | @hook_module.add_listener(TestHook3) | |
|
153 | assert_match /request/i, @hook_helper.call_hook(:view_layouts_base_html_head)[0] | |
|
146 | 154 | end |
|
147 | 155 | |
|
148 | 156 | def test_call_hook_from_view_with_project_added_to_context |
|
149 | # TODO: Implement test | |
|
157 | @hook_module.add_listener(TestHook3) | |
|
158 | assert_match /project/i, @view_hook_helper.call_hook(:view_layouts_base_html_head) | |
|
150 | 159 | end |
|
151 | 160 | |
|
152 | 161 | def test_call_hook_from_view_with_controller_added_to_context |
|
153 | # TODO: Implement test | |
|
162 | @hook_module.add_listener(TestHook3) | |
|
163 | assert_match /controller/i, @view_hook_helper.call_hook(:view_layouts_base_html_head) | |
|
154 | 164 | end |
|
155 | 165 | |
|
156 | 166 | def test_call_hook_from_view_with_request_added_to_context |
|
157 | # TODO: Implement test | |
|
167 | @hook_module.add_listener(TestHook3) | |
|
168 | assert_match /request/i, @view_hook_helper.call_hook(:view_layouts_base_html_head) | |
|
158 | 169 | end |
|
159 | 170 | |
|
160 | 171 | def test_call_hook_from_view_should_join_responses_with_a_space |
|
161 | # TODO: Implement test | |
|
172 | @hook_module.add_listener(TestHook1) | |
|
173 | @hook_module.add_listener(TestHook2) | |
|
174 | assert_equal 'Test hook 1 listener. Test hook 2 listener.', | |
|
175 | @view_hook_helper.call_hook(:view_layouts_base_html_head) | |
|
162 | 176 | end |
|
163 | 177 | end |
|
164 | 178 |
General Comments 0
You need to be logged in to leave comments.
Login now