[#4568] Change FixedDeliverable so it's markup is automatically paid

This commit is contained in:
Eric Davis
2010-09-29 10:18:25 -07:00
parent 0fd801c709
commit 7a5599b4f9
3 changed files with 18 additions and 1 deletions

View File

@@ -20,6 +20,12 @@ class FixedDeliverable < Deliverable
total
end
# Fixed deliverables are always 100% spent so they markup is captured
# right away.
def fixed_markup_budget_total_spent(date=nil)
fixed_markup_budget_total(date)
end
# Hardcoded value used as a wrapper for the old Budget plugin API.
#
# The Overhead plugin uses this in it's calcuations.

View File

@@ -275,7 +275,7 @@ class ContractsShowTest < ActionController::IntegrationTest
visit_contract_page(@contract)
assert_select "table#deliverables" do
assert_select "#deliverable_details_#{@deliverable1.id}" do
assert_select 'td.fixed_markup_budget_spent', :text => '100'
assert_select 'td.fixed_markup_budget_spent', :text => '4,100'
assert_select 'td.fixed_markup_budget_total', :text => '4,100'
end
end

View File

@@ -65,4 +65,15 @@ class FixedDeliverableTest < ActiveSupport::TestCase
end
end
context "#fixed_markup_budget_total_spent" do
should "be the total markup from fixed budgets because FixedDeliverables are considered 100% paid" do
@deliverable = FixedDeliverable.generate!
FixedBudget.generate!(:deliverable => @deliverable, :budget => '$1,000', :markup => '$100', :paid => true)
FixedBudget.generate!(:deliverable => @deliverable, :budget => '$1,000', :markup => '$100', :paid => false)
assert_equal 200, @deliverable.fixed_markup_budget_total_spent
end
end
end