[#4184] Convert overhead values.

This commit is contained in:
Eric Davis
2010-07-14 10:11:36 -07:00
parent acf6e5e9b4
commit 7865ee69ea
2 changed files with 21 additions and 0 deletions
@@ -36,6 +36,12 @@ module RedmineContracts
deliverable.contract = contract
deliverable.manager = project.users.first
if old_deliverable['overhead'].present?
deliverable.overhead_budgets << OverheadBudget.new(:deliverable => deliverable,
:budget => old_deliverable['overhead'],
:hours => 0)
end
case old_deliverable['type']
when 'FixedDeliverable'
deliverable.total = old_deliverable['fixed_cost']
@@ -59,6 +59,21 @@ class BudgetPluginMigrationTest < ActionController::IntegrationTest
assert_equal [@manager, @manager, @manager], Deliverable.all.collect(&:manager)
end
should "create a new Overhead Budget record for any overhead" do
assert_difference("OverheadBudget.count", 1) do
RedmineContracts::BudgetPluginMigration.migrate(@data)
end
d = Deliverable.find_by_title("Deliverable One")
assert_equal 1, d.overhead_budgets.count
assert_equal 200, d.overhead_budget_total
overhead = d.overhead_budgets.first
assert overhead
assert_equal 200, overhead.budget
assert_equal 0, overhead.hours
end
context "converting Fixed Deliverables" do
should "convert fixed_cost to total" do
RedmineContracts::BudgetPluginMigration.migrate(@data)