FixedDeliverable.spent will now return the fixed cost. #1439

This commit is contained in:
Eric Davis
2008-07-10 17:36:14 -07:00
parent abc4dd84c6
commit c90e7337f5
2 changed files with 11 additions and 7 deletions
+3 -3
View File
@@ -6,10 +6,10 @@ class FixedDeliverable < Deliverable
0
end
# Returns the amount spent. It will always be related to the progress of the
# FixedDeliverable because it is managed by the user
# Returns the amount spent. It will always be the fixed cost because
# that money has been allocated already and is managed by the user
def spent
(self.progress.to_f / 100 ) * self.budget
self.fixed_cost || 0.0
end
def profit # :nodoc:
+8 -4
View File
@@ -8,11 +8,15 @@ describe FixedDeliverable, '.score' do
end
describe FixedDeliverable, '.spent' do
it 'should always equal the progress % * budget' do
it 'should always equal the fixed cost if there are no hours logged' do
@deliverable = FixedDeliverable.new({ :subject => 'test' })
@deliverable.stub!(:progress).and_return(50.0)
@deliverable.stub!(:budget).and_return(5000.0)
@deliverable.spent.should eql(2500.0)
@deliverable.stub!(:fixed_cost).and_return(5000.0)
@deliverable.spent.should eql(5000.0)
end
it 'should return 0.0 if fixed_cost is not set' do
@deliverable = FixedDeliverable.new({ :subject => 'test' })
@deliverable.spent.should eql(0.0)
end
end