diff --git a/init.rb b/init.rb index b7d9116..165f46e 100644 --- a/init.rb +++ b/init.rb @@ -30,3 +30,8 @@ Redmine::Plugin.register :redmine_rate do permission :view_rate, { } end + +require 'redmine_rate/hooks/plugin_timesheet_views_timesheets_time_entry_row_class_hook' +require 'redmine_rate/hooks/plugin_timesheet_views_timesheet_group_header_hook' +require 'redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_hook' +require 'redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook' diff --git a/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_group_header_hook.rb b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_group_header_hook.rb new file mode 100644 index 0000000..8edde5b --- /dev/null +++ b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_group_header_hook.rb @@ -0,0 +1,9 @@ +module RedmineRate + module Hooks + class PluginTimesheetViewsTimesheetGroupHeaderHook < Redmine::Hook::ViewListener + def plugin_timesheet_views_timesheet_group_header(context={}) + return '' + end + end + end +end diff --git a/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_hook.rb b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_hook.rb new file mode 100644 index 0000000..4254428 --- /dev/null +++ b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_hook.rb @@ -0,0 +1,9 @@ +module RedmineRate + module Hooks + class PluginTimesheetViewsTimesheetTimeEntryHook < Redmine::Hook::ViewListener + def plugin_timesheet_views_timesheet_time_entry(context={}) + return '' + end + end + end +end diff --git a/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook.rb b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook.rb new file mode 100644 index 0000000..67f57a1 --- /dev/null +++ b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook.rb @@ -0,0 +1,9 @@ +module RedmineRate + module Hooks + class PluginTimesheetViewsTimesheetTimeEntrySumHook < Redmine::Hook::ViewListener + def plugin_timesheet_views_timesheet_time_entry_sum(context={}) + return '' + end + end + end +end diff --git a/lib/redmine_rate/hooks/plugin_timesheet_views_timesheets_time_entry_row_class_hook.rb b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheets_time_entry_row_class_hook.rb new file mode 100644 index 0000000..0b4ea33 --- /dev/null +++ b/lib/redmine_rate/hooks/plugin_timesheet_views_timesheets_time_entry_row_class_hook.rb @@ -0,0 +1,9 @@ +module RedmineRate + module Hooks + class PluginTimesheetViewsTimesheetsTimeEntryRowClassHook < Redmine::Hook::ViewListener + def plugin_timesheet_views_timesheets_time_entry_row_class(context={}) + return '' + end + end + end +end diff --git a/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_group_header_hook_test.rb b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_group_header_hook_test.rb new file mode 100644 index 0000000..30d51f6 --- /dev/null +++ b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_group_header_hook_test.rb @@ -0,0 +1,26 @@ +require File.dirname(__FILE__) + '/../../../../test_helper' + +class RedmineRate::Hooks::PluginTimesheetViewsTimesheetGroupHeaderTest < ActionController::TestCase + include Redmine::Hook::Helper + + def controller + @controller ||= ApplicationController.new + @controller.response ||= ActionController::TestResponse.new + @controller + end + + def request + @request ||= ActionController::TestRequest.new + end + + def hook(args={}) + call_hook :plugin_timesheet_views_timesheet_group_header, args + end + + context "#plugin_timesheet_views_timesheet_group_header" do + should "return an empty string" do + @response.body = hook + assert @response.body.blank? + end + end +end diff --git a/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_hook_test.rb b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_hook_test.rb new file mode 100644 index 0000000..3dcfb94 --- /dev/null +++ b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_hook_test.rb @@ -0,0 +1,26 @@ +require File.dirname(__FILE__) + '/../../../../test_helper' + +class RedmineRate::Hooks::PluginTimesheetViewsTimesheetTimeEntryTest < ActionController::TestCase + include Redmine::Hook::Helper + + def controller + @controller ||= ApplicationController.new + @controller.response ||= ActionController::TestResponse.new + @controller + end + + def request + @request ||= ActionController::TestRequest.new + end + + def hook(args={}) + call_hook :plugin_timesheet_views_timesheet_time_entry, args + end + + context "#plugin_timesheet_views_timesheet_time_entry" do + should "return an empty string" do + @response.body = hook + assert @response.body.blank? + end + end +end diff --git a/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook_test.rb b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook_test.rb new file mode 100644 index 0000000..7b714ae --- /dev/null +++ b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheet_time_entry_sum_hook_test.rb @@ -0,0 +1,26 @@ +require File.dirname(__FILE__) + '/../../../../test_helper' + +class RedmineRate::Hooks::PluginTimesheetViewsTimesheetTimeEntrySumTest < ActionController::TestCase + include Redmine::Hook::Helper + + def controller + @controller ||= ApplicationController.new + @controller.response ||= ActionController::TestResponse.new + @controller + end + + def request + @request ||= ActionController::TestRequest.new + end + + def hook(args={}) + call_hook :plugin_timesheet_views_timesheet_time_entry_sum, args + end + + context "#plugin_timesheet_views_timesheet_time_entry_sum" do + should "return an empty string" do + @response.body = hook + assert @response.body.blank? + end + end +end diff --git a/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheets_time_entry_row_class_hook_test.rb b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheets_time_entry_row_class_hook_test.rb new file mode 100644 index 0000000..57c5ac6 --- /dev/null +++ b/test/unit/lib/redmine_rate/hooks/plugin_timesheet_views_timesheets_time_entry_row_class_hook_test.rb @@ -0,0 +1,26 @@ +require File.dirname(__FILE__) + '/../../../../test_helper' + +class RedmineRate::Hooks::PluginTimesheetViewsTimesheetsTimeEntryRowClassTest < ActionController::TestCase + include Redmine::Hook::Helper + + def controller + @controller ||= ApplicationController.new + @controller.response ||= ActionController::TestResponse.new + @controller + end + + def request + @request ||= ActionController::TestRequest.new + end + + def hook(args={}) + call_hook :plugin_timesheet_views_timesheets_time_entry_row_class, args + end + + context "#plugin_timesheet_views_timesheets_time_entry_row_class" do + should "return an empty string" do + @response.body = hook + assert @response.body.blank? + end + end +end