HourlyDeliverable profit was being counted twice because HourlyDeliverable.profit would return the actual profit or the profit percent already. #1389

This commit is contained in:
Eric Davis
2008-06-30 15:32:00 -07:00
parent 5e36cf455e
commit a5d88b67a8
2 changed files with 4 additions and 12 deletions

View File

@@ -340,8 +340,8 @@ describe Budget, '.profit' do
it 'should be calculated by the total profit of the deliverables with % amounts' do
@project = mock_model(Project)
@deliverable1 = mock_model(HourlyDeliverable, :project_id => @project, :profit_percent => 10, :budget => 2000.0, :profit => nil)
@deliverable2 = mock_model(HourlyDeliverable, :project_id => @project, :profit_percent => 10, :budget => 1000.0, :profit => nil)
@deliverable1 = mock_model(HourlyDeliverable, :project_id => @project, :profit_percent => 10, :budget => 2000.0, :profit => 200)
@deliverable2 = mock_model(HourlyDeliverable, :project_id => @project, :profit_percent => 10, :budget => 1000.0, :profit => 100)
Deliverable.stub!(:find_all_by_project_id).and_return([@deliverable1, @deliverable2])
Project.stub!(:find).with(@project.id).and_return(@project)