diff --git a/app/models/contract.rb b/app/models/contract.rb index 57e0e26..c196969 100644 --- a/app/models/contract.rb +++ b/app/models/contract.rb @@ -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 diff --git a/test/unit/contract_test.rb b/test/unit/contract_test.rb index df9efcf..715914b 100644 --- a/test/unit/contract_test.rb +++ b/test/unit/contract_test.rb @@ -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