[#4420] Working on creating labor budgets for each retainer month.
This commit is contained in:
@@ -127,7 +127,16 @@ class DeliverablesNewTest < ActionController::IntegrationTest
|
||||
fill_in "Start", :with => '2010-01-01'
|
||||
fill_in "End Date", :with => '2010-12-31'
|
||||
fill_in "Notes", :with => 'Some notes on the deliverable'
|
||||
fill_in "Total", :with => '1,000.00'
|
||||
|
||||
within("#deliverable-labor") do
|
||||
fill_in "hrs", :with => '20'
|
||||
fill_in "$", :with => '$2,000'
|
||||
end
|
||||
|
||||
within("#deliverable-overhead") do
|
||||
fill_in "hrs", :with => '10'
|
||||
fill_in "$", :with => '$1,000'
|
||||
end
|
||||
|
||||
click_button "Save"
|
||||
|
||||
@@ -142,6 +151,39 @@ class DeliverablesNewTest < ActionController::IntegrationTest
|
||||
assert_equal '2010-12-31', @deliverable.end_date.to_s
|
||||
assert_equal @manager, @deliverable.manager
|
||||
assert_equal "monthly", @deliverable.frequency
|
||||
|
||||
# Budget items, one per month
|
||||
labor_budgets = @deliverable.labor_budgets
|
||||
assert_equal 12, labor_budgets.length
|
||||
|
||||
labor_budgets.each do |budget|
|
||||
assert_equal 2000, budget.budget
|
||||
assert_equal 20, budget.hours
|
||||
end
|
||||
|
||||
# Budget dates
|
||||
labor_budgets.each do |budget|
|
||||
assert_equal 2010, budget.year
|
||||
end
|
||||
(1..12).each do |month_number|
|
||||
assert_equal 1, labor_budgets.select {|b| b.month == month_number}.length
|
||||
end
|
||||
|
||||
overhead_budgets = @deliverable.overhead_budgets
|
||||
assert_equal 12, overhead_budgets.length
|
||||
|
||||
overhead_budgets.each do |budget|
|
||||
assert_equal 1000, budget.budget
|
||||
assert_equal 10, budget.hours
|
||||
end
|
||||
|
||||
# Budget dates
|
||||
overhead_budgets.each do |budget|
|
||||
assert_equal 2010, budget.year
|
||||
end
|
||||
(1..12).each do |month_number|
|
||||
assert_equal 1, overhead_budgets.select {|b| b.month == month_number}.length
|
||||
end
|
||||
end
|
||||
|
||||
should "create new budget items for the deliverables" do
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user