[#4420] Working on creating labor budgets for each retainer month.

This commit is contained in:
Eric Davis
2010-08-23 16:15:57 -07:00
parent f899b4e623
commit 7d43ab7d74
5 changed files with 125 additions and 26 deletions
+20 -25
View File
@@ -10,36 +10,31 @@ class RetainerDeliverableTest < ActiveSupport::TestCase
should_not_allow_values_for(:frequency, 'anything', 'else', 'weekly')
end
# TODO: Question: Fit to calendar or based on N days?
# Monthly => June-June or June 5th-July 5th
# Quarterly => Jan-March 31 or Feb-May 31
context "#current_period" do
context "monthly frequency" do
should "be a range of the current month"
context "#create_budgets_for_periods" do
setup do
@deliverable = RetainerDeliverable.generate!(:start_date => '2010-01-10',
:end_date => '2010-10-10')
LaborBudget.generate!(:deliverable => @deliverable)
end
context "quarterly frequency" do
should "be a range of the current quarter"
end
end
should "create a dated labor budget for each month" do
assert_equal 1, @deliverable.labor_budgets.count
context "#start_of_current_period" do
context "monthly frequency" do
should "QUESTION: be the first day of the month or 30 days ago"
@deliverable.reload.create_budgets_for_periods
assert_equal 10, @deliverable.labor_budgets.count
labor_budgets = @deliverable.labor_budgets
labor_budgets.each do |budget|
assert_equal 2010, budget.year
end
(1..10).each do |month_number|
assert_equal 1, labor_budgets.select {|b| b.month == month_number}.length
end
end
context "quarterly frequency" do
should "QUESTION: be the first day of the quarter or 365/4 days ago"
end
should "create a dated overhead budget for each month"
end
context "#end_of_current_period" do
context "monthly frequency" do
should "QUESTION: be the first day of the month or 30 days ago"
end
context "quarterly frequency" do
should "QUESTION: be the first day of the quarter or 365/4 days ago"
end
end
end