[#2275] Don't need to check for the budget module for this.
This commit is contained in:
1 parent
d3f6ca5433
commit
a61b41a22b
2 files changed
+5
-29
No files matched your search
@@ -1,12 +1,8 @@
|
|||||||
class OverheadIssueHook < Redmine::Hook::ViewListener
|
class OverheadIssueHook < Redmine::Hook::ViewListener
|
||||||
def view_issues_show_details_bottom(context={})
|
def view_issues_show_details_bottom(context={})
|
||||||
if context[:project].module_enabled?('budget_module')
|
return context[:controller].send(:render_to_string, {
|
||||||
return context[:controller].send(:render_to_string, {
|
:partial => 'issues/show_overhead',
|
||||||
:partial => 'issues/show_overhead',
|
:locals => {:issue => context[:issue]}
|
||||||
:locals => {:issue => context[:issue]}
|
})
|
||||||
})
|
|
||||||
else
|
|
||||||
return ''
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
@@ -5,33 +5,13 @@ def stub_view_to_use_controller_instance
|
|||||||
self.stub!(:controller).and_return(@controller)
|
self.stub!(:controller).and_return(@controller)
|
||||||
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
|
|
||||||
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
|
describe OverheadIssueHook, "#view_issues_show_details_bottom with the budget disabled", :type => :view do
|
||||||
include Redmine::Hook::Helper
|
include Redmine::Hook::Helper
|
||||||
|
|
||||||
before(:each) do
|
before(:each) do
|
||||||
stub_view_to_use_controller_instance
|
stub_view_to_use_controller_instance
|
||||||
@project = mock_model(Project)
|
@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)
|
@issue = mock_model(Issue, :project => @project, :deliverable => nil, :billable_time_spent => nil, :overhead_time_spent => nil)
|
||||||
|
|
||||||
@context = {
|
@context = {
|
||||||
|
|||||||
Reference in new issue
Block a user