[#4568] Change FixedDeliverable so it's markup is automatically paid
This commit is contained in:
@@ -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.
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user