Completed deliverable.spent calculation. #1136
This commit is contained in:
1 parent
9df51da8f8
commit
65da8e7594
6 files changed
+64
-1
No files matched your search
@@ -0,0 +1,28 @@
|
||||
require File.dirname(__FILE__) + '/../spec_helper'
|
||||
|
||||
describe HourlyDeliverable, '.spent' do
|
||||
it 'should equal 0 if there are no issues for the deliverable' do
|
||||
@deliverable = HourlyDeliverable.new({ :subject => 'test' })
|
||||
@deliverable.should_receive(:issues).and_return([])
|
||||
|
||||
@deliverable.spent.should eql(0)
|
||||
end
|
||||
|
||||
it 'should return the sum of the member timelogs' do
|
||||
@project = mock_model(Project)
|
||||
@user = mock_model(User)
|
||||
@issue1 = mock_model(Issue)
|
||||
|
||||
@issue_1_time_entry = mock_model(TimeEntry, :issue_id => @issue1.id, :user_id => @user.id, :project_id => @project.id, :hours => 1.0)
|
||||
@issue1.stub!(:time_entries).and_return([@issue_1_time_entry])
|
||||
|
||||
@member = mock_model(Member, :user => @user, :project => @project, :rate => 60.0)
|
||||
Member.should_receive(:find_by_user_id_and_project_id).with(@user.id, @project.id).and_return(@member)
|
||||
|
||||
@deliverable = HourlyDeliverable.new({ :subject => 'test' })
|
||||
@issues = [@issue1]
|
||||
@deliverable.should_receive(:issues).twice.and_return(@issues)
|
||||
|
||||
@deliverable.spent.should eql(60.0)
|
||||
end
|
||||
end
|
||||
Reference in new issue
Block a user