[#4180] Block total from getting set on HourlyDeliverables.

This commit is contained in:
Eric Davis
2010-07-02 11:38:29 -07:00
parent fa1ef6bf10
commit 5074667b28
3 changed files with 40 additions and 0 deletions
+16
View File
@@ -7,7 +7,23 @@ class HourlyDeliverable < Deliverable
# Accessors
# Callbacks
before_save :clear_total
def short_type
'H'
end
# Block getting and setting the total on HourlyDeliverables
def total
nil
end
def total=(v)
nil
end
def clear_total
write_attribute(:total, nil)
end
end
@@ -90,6 +90,7 @@ 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'
# Hide and clear the total
assert js("jQuery('#deliverable_total_input').is(':hidden')"),
+23
View File
@@ -0,0 +1,23 @@
require File.dirname(__FILE__) + '/../test_helper'
class HourlyDeliverableTest < ActiveSupport::TestCase
context "#total=" do
should "not write any attributes" do
d = HourlyDeliverable.new
d.total = '$100.00'
assert_equal nil, d.total
end
end
context "clear_total" do
should "clear any total attributes" do
d = HourlyDeliverable.new
d.write_attribute(:total, 100.00)
d.clear_total
assert_equal nil, d.total
end
end
end