<?xml version="1.0" encoding="UTF-8"?>
<commit>
  <added type="array"/>
  <modified type="array">
    <modified>
      <diff>@@ -306,3 +306,33 @@ describe Deliverable, 'budget_remaining' do
     deliverable.budget_remaining.should eql(deliverable.left)
   end
 end
+
+describe Deliverable, 'hours_used' do
+  it 'should return 0 if there are no issues on the Deliverable' do
+    deliverable = Deliverable.new
+    deliverable.hours_used.should eql(0)
+  end
+
+  it 'should total up the hours on the issues assigned to the Deliverable' do
+    deliverable = Deliverable.new
+    time_entries = [mock_model(TimeEntry, :hours =&gt; 100)]
+    issues = [mock_model(Issue, :time_entries =&gt; time_entries)]
+    deliverable.should_receive(:issues).at_least(:once).and_return(issues)
+    
+    deliverable.hours_used.should eql(100)
+  end
+end
+
+describe Deliverable, 'overruns' do
+  it 'should be 0 if there still is budget left' do
+    deliverable = Deliverable.new
+    deliverable.should_receive(:left).and_return(100)
+    deliverable.overruns.should eql(0)
+  end
+
+  it 'should be the invoice of left if left is below 0' do
+    deliverable = Deliverable.new
+    deliverable.should_receive(:left).at_least(:once).and_return(-100)
+    deliverable.overruns.should eql(100)
+  end
+end</diff>
      <filename>spec/models/deliverable_spec.rb</filename>
    </modified>
  </modified>
  <removed type="array"/>
  <parents type="array">
    <parent>
      <id>049885c1705970165b4eb5a4eacaec0291661541</id>
    </parent>
  </parents>
  <author>
    <name>Eric Davis</name>
    <email>edavis@littlestreamsoftware.com</email>
  </author>
  <url>http://github.com/edavis10/redmine-budget-plugin/commit/ad67e1634f82bc15ceb5e01892884e39ec50ad85</url>
  <id>ad67e1634f82bc15ceb5e01892884e39ec50ad85</id>
  <committed-date>2009-01-21T16:27:39-08:00</committed-date>
  <authored-date>2009-01-21T16:27:39-08:00</authored-date>
  <message>Found some more calculation methods that were not tested. #1924</message>
  <tree>3528711cfd1f1c10ef5c5896592794fe779d6ecc</tree>
  <committer>
    <name>Eric Davis</name>
    <email>edavis@littlestreamsoftware.com</email>
  </committer>
</commit>
