[#4184] Convert overhead values.

This commit is contained in:
Eric Davis committed 2010-07-14 10:11:36 -07:00
1 parent acf6e5e9b4
commit 7865ee69ea
2 files changed
+21

No files matched your search

@@ -36,6 +36,12 @@ module RedmineContracts
deliverable.contract = contract deliverable.contract = contract
deliverable.manager = project.users.first 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'] case old_deliverable['type']
when 'FixedDeliverable' when 'FixedDeliverable'
deliverable.total = old_deliverable['fixed_cost'] deliverable.total = old_deliverable['fixed_cost']
@@ -59,6 +59,21 @@ class BudgetPluginMigrationTest < ActionController::IntegrationTest
assert_equal [@manager, @manager, @manager], Deliverable.all.collect(&:manager) assert_equal [@manager, @manager, @manager], Deliverable.all.collect(&:manager)
end 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 context "converting Fixed Deliverables" do
should "convert fixed_cost to total" do should "convert fixed_cost to total" do
RedmineContracts::BudgetPluginMigration.migrate(@data) RedmineContracts::BudgetPluginMigration.migrate(@data)