Added some defaults when there are no deliverables.

This commit is contained in:
Eric Davis
2008-05-28 13:03:42 -07:00
parent 990a10a4e8
commit c433de9ec7
2 changed files with 24 additions and 2 deletions

View File

@@ -200,6 +200,17 @@ describe Budget,'.budget' do
@budget = Budget.new(@project.id)
@budget.budget.should eql(5000.0)
end
it 'should be 0 if there are no deliverables' do
Deliverable.stub!(:find_all_by_project_id).and_return([])
@project = mock_model(Project)
Project.stub!(:find).with(@project.id).and_return(@project)
@budget = Budget.new(@project.id)
@budget.budget.should eql(0.0)
end
end
describe Budget,'.budget_ratio' do
@@ -277,4 +288,15 @@ describe Budget, '.spent' do
@budget.spent.should eql(1500.0)
end
it 'should be 0 if there are no deliverables' do
Deliverable.stub!(:find_all_by_project_id).and_return([])
@project = mock_model(Project)
Project.stub!(:find).with(@project.id).and_return(@project)
@budget = Budget.new(@project.id)
@budget.spent.should eql(0.0)
end
end