[#6636] Add Deliverable#spent_for_user to get the billable/non-billable cost by user
This commit is contained in:
@@ -279,4 +279,43 @@ class DeliverableTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
context "#spent_for_user" do
|
||||
setup do
|
||||
configure_overhead_plugin
|
||||
create_contract_and_deliverable
|
||||
create_issue_with_time_for_deliverable(@deliverable, {
|
||||
:activity => @billable_activity,
|
||||
:user => @manager,
|
||||
:hours => 5,
|
||||
:amount => 100
|
||||
})
|
||||
create_issue_with_time_for_deliverable(@deliverable, {
|
||||
:activity => @billable_activity,
|
||||
:user => @manager,
|
||||
:hours => 5,
|
||||
:amount => 100
|
||||
})
|
||||
create_issue_with_time_for_deliverable(@deliverable, {
|
||||
:activity => @non_billable_activity,
|
||||
:user => @manager,
|
||||
:hours => 5,
|
||||
:amount => 100
|
||||
})
|
||||
|
||||
end
|
||||
|
||||
context "with billable_time_only as true" do
|
||||
should "return the total cost the user has logged on billable time entries" do
|
||||
assert_equal 1000, @deliverable.spent_for_user(@manager, true)
|
||||
end
|
||||
end
|
||||
|
||||
context "with billable_time_only as false" do
|
||||
should "return the total cost the user has logged on non-billable time entries" do
|
||||
assert_equal 500, @deliverable.spent_for_user(@manager, false)
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user