[#2847] Created a very basic set of hooks for the Deliverables table in the Budget plugin.

This commit is contained in:
Eric Davis
2009-08-05 13:45:36 -07:00
parent ea1c466134
commit 47869780a6
3 changed files with 70 additions and 0 deletions

View File

@@ -12,6 +12,7 @@ Dispatcher.to_prepare do
end end
require 'overhead_timesheet_hook' require 'overhead_timesheet_hook'
require 'overhead_budget_hook'
Redmine::Plugin.register :redmine_overhead do Redmine::Plugin.register :redmine_overhead do
name 'Overhead plugin' name 'Overhead plugin'

View File

@@ -0,0 +1,19 @@
class OverheadBudgetHook < Redmine::Hook::ViewListener
def plugin_budget_view_deliverable_list_header(context={})
return content_tag(:th, '')
end
def plugin_budget_view_deliverable_summary_row(context={})
return content_tag(:td, '')
end
def plugin_budget_view_deliverable_details_row(context={})
return content_tag(:td, '')
end
def plugin_budget_view_deliverable_description_row(context={})
return content_tag(:td, '')
end
end

View File

@@ -0,0 +1,50 @@
require File.dirname(__FILE__) + '/../spec_helper'
# Hack to make RSpec play nicely with call_hook's default contexts
def stub_view_to_use_controller_instance
self.stub!(:controller).and_return(@controller)
end
describe OverheadBudgetHook, "#plugin_budget_view_deliverable_list_header", :type => :view do
include Redmine::Hook::Helper
before(:each) do
stub_view_to_use_controller_instance
end
end
describe OverheadBudgetHook, "#plugin_budget_view_deliverable_summary_row", :type => :view do
include Redmine::Hook::Helper
before(:each) do
stub_view_to_use_controller_instance
end
end
describe OverheadBudgetHook, "#plugin_budget_view_deliverable_details_row", :type => :view do
include Redmine::Hook::Helper
before(:each) do
stub_view_to_use_controller_instance
end
it 'should return an empty table cell to align the table' do
call_hook(:plugin_budget_view_deliverable_details_row, {}).should have_tag('td','')
end
end
describe OverheadBudgetHook, "#plugin_budget_view_deliverable_description_row", :type => :view do
include Redmine::Hook::Helper
before(:each) do
stub_view_to_use_controller_instance
end
it 'should return an empty table cell to align the table' do
call_hook(:plugin_budget_view_deliverable_description_row, {}).should have_tag('td','')
end
end