From e25f841fe2e38f6cc4353635615b02f00a2c14b9 Mon Sep 17 00:00:00 2001 From: Eric Davis Date: Thu, 1 Jul 2010 13:13:08 -0700 Subject: [PATCH] [#4225] Generated a hook for the timelog available criterias. --- init.rb | 1 + ...roller_timelog_available_criterias_hook.rb | 9 +++++++++ ...r_timelog_available_criterias_hook_spec.rb | 19 +++++++++++++++++++ 3 files changed, 29 insertions(+) create mode 100644 lib/redmine_budget/hooks/controller_timelog_available_criterias_hook.rb create mode 100644 spec/models/controller_timelog_available_criterias_hook_spec.rb diff --git a/init.rb b/init.rb index e6ea70f..c400da8 100644 --- a/init.rb +++ b/init.rb @@ -45,3 +45,4 @@ Redmine::Plugin.register :budget_plugin do menu :project_menu, :budget, {:controller => "deliverables", :action => 'index'}, :caption => :budget_title end +require 'redmine_budget/hooks/controller_timelog_available_criterias_hook' diff --git a/lib/redmine_budget/hooks/controller_timelog_available_criterias_hook.rb b/lib/redmine_budget/hooks/controller_timelog_available_criterias_hook.rb new file mode 100644 index 0000000..7986143 --- /dev/null +++ b/lib/redmine_budget/hooks/controller_timelog_available_criterias_hook.rb @@ -0,0 +1,9 @@ +module RedmineBudget + module Hooks + class ControllerTimelogAvailableCriteriasHook < Redmine::Hook::ViewListener + def controller_timelog_available_criterias(context={}) + return '' + end + end + end +end diff --git a/spec/models/controller_timelog_available_criterias_hook_spec.rb b/spec/models/controller_timelog_available_criterias_hook_spec.rb new file mode 100644 index 0000000..8eef810 --- /dev/null +++ b/spec/models/controller_timelog_available_criterias_hook_spec.rb @@ -0,0 +1,19 @@ +require File.dirname(__FILE__) + '/../spec_helper' + +include Redmine::Hook::Helper + +def controller + @controller ||= TimelogController.new + @controller.response ||= ActionController::TestResponse.new + @controller +end + +def request + @request ||= ActionController::TestRequest.new +end + +describe TimelogController, '#controller_timelog_available_criterias_hook', :type => :controller do + it 'should return an empty string' do + call_hook(:controller_timelog_available_criterias, {}).should be_blank + end +end