[#4177] Default Contract#executed to false.
This commit is contained in:
@@ -29,6 +29,10 @@ class Contract < ActiveRecord::Base
|
||||
attr_accessible :po_number
|
||||
attr_accessible :details
|
||||
|
||||
def after_initialize
|
||||
self.executed = false unless self.executed.present?
|
||||
end
|
||||
|
||||
def start_and_end_date_are_valid
|
||||
if start_date && end_date && end_date < start_date
|
||||
errors.add :end_date, :greater_than_start_date
|
||||
|
||||
@@ -26,6 +26,11 @@ class ContractTest < ActiveSupport::TestCase
|
||||
end
|
||||
|
||||
should "QUESTION: name be unique"
|
||||
should "default executed to false"
|
||||
|
||||
should "default executed to false" do
|
||||
@contract = Contract.new
|
||||
|
||||
assert_equal false, @contract.executed
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user