Removed all the duplicate methods that were getting the rate for each TimeEntry

and replaced them with a simple collector that uses the new TimeEntry#cost
method (that wraps the Rate API).

  #1924
This commit is contained in:
Eric Davis
2009-01-21 15:20:21 -08:00
parent 7fa4f33748
commit 3d8c1ecc5c
6 changed files with 9 additions and 42 deletions

View File

@@ -26,10 +26,9 @@ describe FixedDeliverable, '.spent' do
@issue1 = mock_model(Issue)
@issue_1_time_entry = mock_model(TimeEntry, :issue_id => @issue1.id, :user => @user, :project => @project, :hours => 1.0, :spent_on => Date.today)
@issue_1_time_entry.should_receive(:cost).and_return(60.0)
@issue1.stub!(:time_entries).and_return([@issue_1_time_entry])
Rate.should_receive(:amount_for).with(@user, @project, @issue_1_time_entry.spent_on.to_s).and_return(60.0)
@deliverable = FixedDeliverable.new({ :subject => 'test' })
@issues = [@issue1]
@deliverable.stub!(:fixed_cost).and_return(5000.0)

View File

@@ -14,10 +14,9 @@ describe HourlyDeliverable, '.spent' do
@issue1 = mock_model(Issue)
@issue_1_time_entry = mock_model(TimeEntry, :issue_id => @issue1.id, :user => @user, :project => @project, :hours => 1.0, :spent_on => Date.today)
@issue_1_time_entry.should_receive(:cost).and_return(60.0)
@issue1.stub!(:time_entries).and_return([@issue_1_time_entry])
Rate.should_receive(:amount_for).with(@user, @project, @issue_1_time_entry.spent_on.to_s).and_return(60.0)
@deliverable = HourlyDeliverable.new({ :subject => 'test' })
@issues = [@issue1]
@deliverable.should_receive(:issues).twice.and_return(@issues)