@@ -50,11 +50,16 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||||
50 | include Redmine::Hook::Helper |
|
50 | include Redmine::Hook::Helper | |
51 | end |
|
51 | end | |
52 |
|
52 | |||
|
53 | class TestHookHelperView < ActionView::Base | |||
|
54 | include Redmine::Hook::Helper | |||
|
55 | end | |||
|
56 | ||||
53 | Redmine::Hook.clear_listeners |
|
57 | Redmine::Hook.clear_listeners | |
54 |
|
58 | |||
55 | def setup |
|
59 | def setup | |
56 | @hook_module = Redmine::Hook |
|
60 | @hook_module = Redmine::Hook | |
57 | @hook_helper = TestHookHelperController.new |
|
61 | @hook_helper = TestHookHelperController.new | |
|
62 | @view_hook_helper = TestHookHelperView.new(RAILS_ROOT + '/app/views') | |||
58 | end |
|
63 | end | |
59 |
|
64 | |||
60 | def teardown |
|
65 | def teardown | |
@@ -134,31 +139,40 class Redmine::Hook::ManagerTest < Test::Unit::TestCase | |||||
134 |
|
139 | |||
135 | # Context: Redmine::Hook::Helper.call_hook |
|
140 | # Context: Redmine::Hook::Helper.call_hook | |
136 | def test_call_hook_with_project_added_to_context |
|
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 | end |
|
144 | end | |
139 |
|
145 | |||
140 | def test_call_hook_from_controller_with_controller_added_to_context |
|
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 | end |
|
149 | end | |
143 |
|
150 | |||
144 | def test_call_hook_from_controller_with_request_added_to_context |
|
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 | end |
|
154 | end | |
147 |
|
155 | |||
148 | def test_call_hook_from_view_with_project_added_to_context |
|
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 | end |
|
159 | end | |
151 |
|
160 | |||
152 | def test_call_hook_from_view_with_controller_added_to_context |
|
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 | end |
|
164 | end | |
155 |
|
165 | |||
156 | def test_call_hook_from_view_with_request_added_to_context |
|
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 | end |
|
169 | end | |
159 |
|
170 | |||
160 | def test_call_hook_from_view_should_join_responses_with_a_space |
|
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 | end |
|
176 | end | |
163 | end |
|
177 | end | |
164 |
|
178 |
General Comments 0
You need to be logged in to leave comments.
Login now