From e96bdccb428cf630d64fd35c03fc00732ef9e11d Mon Sep 17 00:00:00 2001
From: Eric Davis
- Next Due Date: <%= h distance_of_time_in_words_to_now(@budget.next_due_date) %> + Next Due Date: <%= h distance_of_time_in_words_to_now(@budget.next_due_date) if @budget.next_due_date %>
- Completion: <%= h distance_of_time_in_words_to_now(@budget.final_due_date) %> + Completion: <%= h distance_of_time_in_words_to_now(@budget.final_due_date) if @budget.final_due_date %>
Profit: TODO diff --git a/spec/models/budget_spec.rb b/spec/models/budget_spec.rb index 2e8add8..b78afeb 100644 --- a/spec/models/budget_spec.rb +++ b/spec/models/budget_spec.rb @@ -224,6 +224,17 @@ describe Budget,'.budget_ratio' do @budget.should_receive(:spent).and_return(2000.00) @budget.budget_ratio.should eql(40) end + + it 'should return progress if the budget is < 0' do + @project = mock_model(Project) + Project.stub!(:find).with(@project.id).and_return(@project) + + @budget = Budget.new(@project.id) + @budget.should_receive(:budget).and_return(0.0) + @budget.should_receive(:progress).and_return(50) + @budget.budget_ratio.should eql(50) + end + end