[#4184] Starting on the budget data migration.

This commit is contained in:
Eric Davis
2010-07-13 14:35:23 -07:00
parent d8196842ff
commit 30172b4be1
3 changed files with 97 additions and 0 deletions
@@ -0,0 +1,18 @@
module RedmineContracts
# TODO: decide how this is activated.
# Have the user dump yaml themselves? Or rename the tables and
# SQL select the data out into yaml?
# Deliverable.all.collect {|d| d.attributes}.to_yaml
class BudgetPluginMigration
@@data = nil
def self.migrate(old_data)
@@data = old_data
end
def self.data
@@data
end
end
end
+55
View File
@@ -0,0 +1,55 @@
---
- total_hours: 100.0
overhead: 200.0
profit_percent:
project_id: 1
fixed_cost:
cost_per_hour: 50.0
subject: Deliverable One
materials: 200.0
id: 1
type: HourlyDeliverable
project_manager_signoff: false
profit: 200.0
overhead_percent:
description: ""
materials_percent:
due: 2008-06-30
budget: 5600.0
client_signoff: false
- total_hours: 12.0
overhead:
profit_percent: 50
project_id: 2
fixed_cost:
cost_per_hour: 25.0
subject: Deliverable 2
materials: 0.0
id: 2
type: HourlyDeliverable
project_manager_signoff: false
profit:
overhead_percent: 150
description: ""
materials_percent:
due: 2008-06-18
budget: 900.0
client_signoff: false
- total_hours: 80.0
overhead:
profit_percent: 150
project_id: 2
fixed_cost: 30000.0
cost_per_hour: 85.0
subject: Version 1.0
materials: 0.0
id: 3
type: FixedDeliverable
project_manager_signoff: true
profit:
overhead_percent: 60
description: Some description here
materials_percent:
due: 2008-05-01
budget: 93000.0
client_signoff: true
@@ -0,0 +1,24 @@
require 'test_helper'
class BudgetPluginMigrationTest < ActionController::IntegrationTest
def setup
configure_overhead_plugin
end
def load_test_fixture
YAML.load(File.read(File.expand_path(File.dirname(__FILE__)) + "/../fixtures/budget_plugin_migration/budget.yml"))
end
context "migrate" do
should "load a YAML dump of the old budget data" do
@data = load_test_fixture
RedmineContracts::BudgetPluginMigration.migrate(@data)
assert RedmineContracts::BudgetPluginMigration.data
end
should "create a new Deliverable for each old Deliverable"
should "create a new Contract for each project that had an old deliverable"
end
end