Added some defaults when there are no deliverables.
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user