[#6636] Add table for issue categories to the deliverable finance report

This commit is contained in:
Eric Davis
2011-10-13 15:54:53 -07:00
parent bbf5d70170
commit 63cc58a459
2 changed files with 176 additions and 15 deletions
+63 -13
View File
@@ -14,20 +14,31 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
@deliverable1.save!
@user = User.generate_user_with_permission_to_manage_budget(:project => @project)
@category_on_billable = IssueCategory.generate!(:project => @project).reload
@category_on_non_billable = IssueCategory.generate!(:project => @project).reload
# 2 hours of $100 billable work
create_issue_with_time_for_deliverable(@deliverable1, {
:activity => @billable_activity,
:user => @manager,
:hours => 2,
:amount => 100
:amount => 100,
:issue_category => @category_on_billable
})
# 1 hour of $100 billable work with no category
create_issue_with_time_for_deliverable(@deliverable1, {
:activity => @billable_activity,
:user => @manager,
:hours => 1,
:amount => 100,
:issue_category => nil
})
# 5 hours of $100 nonbillable work
create_issue_with_time_for_deliverable(@deliverable1, {
:activity => @non_billable_activity,
:user => @manager,
:hours => 5,
:amount => 100
:amount => 100,
:issue_category => @category_on_non_billable
})
@user.reload
@@ -72,9 +83,9 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
assert_select "h2", :text => /#{@deliverable1.title}/
assert_select "div#finance-summary" do
assert_select "span.spent", :text => /\$200/ # $100 * 2
assert_select "span.spent", :text => /\$300/ # ($100 * 2) + ($100 * 1)
assert_select "span.total", :text => /\$300/ # $100 * 3
assert_select "span.hours", :text => /2/
assert_select "span.hours", :text => /3/
end
end
@@ -82,17 +93,17 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
assert_select "table#deliverable-labor-activities" do
assert_select "tr.labor" do
assert_select "td", :text => /#{@billable_activity.name}/
assert_select "td.spent-amount", :text => /\$200/
assert_select "td.spent-amount", :text => /\$300/
assert_select "td.total-amount", :text => /\$300/
assert_select "td.spent-hours", :text => /2/
assert_select "td.spent-hours", :text => /3/
assert_select "td.total-deliverable-hours", :text => /30/ # 3 month retainer * 10
end
assert_select "tr.summary-row.labor" do
assert_select "td", :text => /Totals/
assert_select "td.spent-amount", :text => /\$200/
assert_select "td.spent-amount", :text => /\$300/
assert_select "td.total-amount", :text => /\$300/
assert_select "td.spent-hours", :text => /2/
assert_select "td.spent-hours", :text => /3/
assert_select "td.total-deliverable-hours", :text => /30/
end
@@ -124,14 +135,14 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
assert_select "table#deliverable-labor-users" do
assert_select "tr.labor" do
assert_select "td", :text => /#{@manager.name}/
assert_select "td.amount-cost", :text => /\$200/
assert_select "td.time-cost", :text => /2/
assert_select "td.amount-cost", :text => /\$300/
assert_select "td.time-cost", :text => /3/
end
assert_select "tr.summary-row" do
assert_select "td", :text => /Totals/
assert_select "td.amount-cost", :text => /\$200/
assert_select "td.time-cost", :text => /2/
assert_select "td.amount-cost", :text => /\$300/
assert_select "td.time-cost", :text => /3/
end
end
@@ -154,5 +165,44 @@ class DeliverableFinancesShowTest < ActionController::IntegrationTest
end
end
should "render the labor finances for each Issue Category for the deliverable" do
assert_select "table#deliverable-labor-issue-categories" do
assert_select "tr.labor" do
assert_select "td", :text => /#{@category_on_billable.name}/
assert_select "td.amount-cost", :text => /\$200/
assert_select "td.time-cost", :text => /2/
end
assert_select "tr.labor" do
assert_select "td", :text => /none/
assert_select "td.amount-cost", :text => /\$100/
assert_select "td.time-cost", :text => /1/
end
assert_select "tr.summary-row" do
assert_select "td", :text => /Totals/
assert_select "td.amount-cost", :text => /\$300/
assert_select "td.time-cost", :text => /3/
end
end
end
should "render the overhead finances for each Issue Category for the deliverable" do
assert_select "table#deliverable-overhead-issue-categories" do
assert_select "tr.overhead" do
assert_select "td", :text => /#{@category_on_non_billable.name}/
assert_select "td.amount-cost", :text => /\$500/
assert_select "td.time-cost", :text => /5/
end
assert_select "tr.summary-row.overhead" do
assert_select "td", :text => /Totals/
assert_select "td.amount-cost", :text => /\$500/
assert_select "td.time-cost", :text => /5/
end
end
end
end
end