[#2275] Don't need to check for the budget module for this.
This commit is contained in:
@@ -1,12 +1,8 @@
|
||||
class OverheadIssueHook < Redmine::Hook::ViewListener
|
||||
def view_issues_show_details_bottom(context={})
|
||||
if context[:project].module_enabled?('budget_module')
|
||||
return context[:controller].send(:render_to_string, {
|
||||
:partial => 'issues/show_overhead',
|
||||
:locals => {:issue => context[:issue]}
|
||||
})
|
||||
else
|
||||
return ''
|
||||
end
|
||||
return context[:controller].send(:render_to_string, {
|
||||
:partial => 'issues/show_overhead',
|
||||
:locals => {:issue => context[:issue]}
|
||||
})
|
||||
end
|
||||
end
|
||||
|
||||
@@ -5,33 +5,13 @@ def stub_view_to_use_controller_instance
|
||||
self.stub!(:controller).and_return(@controller)
|
||||
end
|
||||
|
||||
describe OverheadIssueHook, "#view_issues_show_details_bottom with the budget disabled", :type => :view do
|
||||
include Redmine::Hook::Helper
|
||||
|
||||
before(:each) do
|
||||
stub_view_to_use_controller_instance
|
||||
end
|
||||
|
||||
it 'should return nothing' do
|
||||
project = mock_model(Project)
|
||||
project.should_receive(:module_enabled?).at_least(:once).with('budget_module').and_return(false)
|
||||
|
||||
context = {
|
||||
:project => project,
|
||||
:issue => mock_model(Issue, :project => project, :deliverable => nil)
|
||||
}
|
||||
|
||||
call_hook(:view_issues_show_details_bottom, context).strip.should eql('')
|
||||
end
|
||||
end
|
||||
|
||||
describe OverheadIssueHook, "#view_issues_show_details_bottom with the budget disabled", :type => :view do
|
||||
include Redmine::Hook::Helper
|
||||
|
||||
before(:each) do
|
||||
stub_view_to_use_controller_instance
|
||||
@project = mock_model(Project)
|
||||
@project.should_receive(:module_enabled?).at_least(:once).with('budget_module').and_return(true)
|
||||
@project.stub!(:module_enabled?).and_return(true)
|
||||
@issue = mock_model(Issue, :project => @project, :deliverable => nil, :billable_time_spent => nil, :overhead_time_spent => nil)
|
||||
|
||||
@context = {
|
||||
|
||||
Reference in New Issue
Block a user