[#4225] Add the Deliverable as a criteria in the Time Entries Report.
This commit is contained in:
1 parent
e25f841fe2
commit
aa9649fde3
2 files changed
+46
-4
No files matched your search
@@ -12,8 +12,44 @@ 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
|
||||
def run_hook
|
||||
call_hook(:controller_timelog_available_criterias, {:available_criterias => @available_criterias})
|
||||
end
|
||||
|
||||
describe TimelogController, '#controller_timelog_available_criterias_hook', :type => :controller do
|
||||
before(:each) do
|
||||
@available_criterias = {
|
||||
'project' => {:sql => 'project_id', :klass => Project, :label => :label_project}
|
||||
}
|
||||
end
|
||||
|
||||
it "should always return an empty string" do
|
||||
run_hook.should be_blank
|
||||
end
|
||||
|
||||
it "should add a new hash to the available_criterias" do
|
||||
run_hook
|
||||
|
||||
@available_criterias.should have(2).keys
|
||||
@available_criterias.key?('deliverable_id').should be_true
|
||||
end
|
||||
|
||||
it "should set the :sql field to use the issue's deliverable_id" do
|
||||
run_hook
|
||||
|
||||
@available_criterias['deliverable_id'][:sql].should eql("issues.deliverable_id")
|
||||
end
|
||||
|
||||
it "should set the :klass field to Deliverable" do
|
||||
run_hook
|
||||
|
||||
@available_criterias['deliverable_id'][:klass].should eql(Deliverable)
|
||||
end
|
||||
|
||||
it "should set the :label field to :field_deliverable" do
|
||||
run_hook
|
||||
|
||||
@available_criterias['deliverable_id'][:label].should eql(:field_deliverable)
|
||||
end
|
||||
|
||||
end
|
||||
Reference in new issue
Block a user