[#4184] Convert materials and materials % to OverheadBudgets.

This commit is contained in:
Eric Davis
2010-07-19 08:35:12 -07:00
parent d934f39021
commit 4f9ee03fb5
3 changed files with 46 additions and 5 deletions
+1 -1
View File
@@ -31,7 +31,7 @@
profit:
overhead_percent: 150
description: ""
materials_percent:
materials_percent: 10
due: 2008-06-18
budget: 900.0
client_signoff: false
@@ -60,13 +60,13 @@ class BudgetPluginMigrationTest < ActionController::IntegrationTest
end
should "create a new Overhead Budget record for any overhead" do
assert_difference("OverheadBudget.count", 3) do
assert_difference("OverheadBudget.count", 5) 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
assert_equal 2, d.overhead_budgets.count
assert_equal 400, d.overhead_budget_total
overhead = d.overhead_budgets.first
assert overhead
@@ -75,7 +75,7 @@ class BudgetPluginMigrationTest < ActionController::IntegrationTest
end
should "create a new Overhead Budget record for any overhead percent" do
assert_difference("OverheadBudget.count", 3) do
assert_difference("OverheadBudget.count", 5) do
RedmineContracts::BudgetPluginMigration.migrate(@data)
end
@@ -90,6 +90,35 @@ class BudgetPluginMigrationTest < ActionController::IntegrationTest
end
should "create a new Overhead Budget record for any materials" do
assert_difference("OverheadBudget.count", 5) do
RedmineContracts::BudgetPluginMigration.migrate(@data)
end
d = Deliverable.find_by_title("Deliverable One")
assert_equal 2, d.overhead_budgets.count
assert_equal 400, d.overhead_budget_total
materials = d.overhead_budgets.last
assert materials
assert_equal 200, materials.budget
assert_equal 0, materials.hours
end
should "create a new Overhead Budget record for any overhead percent" do
assert_difference("OverheadBudget.count", 5) do
RedmineContracts::BudgetPluginMigration.migrate(@data)
end
d = Deliverable.find_by_title("Deliverable 2")
assert_equal 2, d.overhead_budgets.count
materials = d.overhead_budgets.last
assert materials
assert_equal 12 * 25 * 0.1, materials.budget
assert_equal 0, materials.hours
end
should "append the YAML dump of the old object to the notes" do
RedmineContracts::BudgetPluginMigration.migrate(@data)
d = Deliverable.find_by_title("Deliverable One")