[#4177] Default Contract#executed to false.
This commit is contained in:
1 parent
56e39ba3ca
commit
512db4bcf4
2 files changed
+10
-1
No files matched your search
@@ -29,6 +29,10 @@ class Contract < ActiveRecord::Base
|
|||||||
attr_accessible :po_number
|
attr_accessible :po_number
|
||||||
attr_accessible :details
|
attr_accessible :details
|
||||||
|
|
||||||
|
def after_initialize
|
||||||
|
self.executed = false unless self.executed.present?
|
||||||
|
end
|
||||||
|
|
||||||
def start_and_end_date_are_valid
|
def start_and_end_date_are_valid
|
||||||
if start_date && end_date && end_date < start_date
|
if start_date && end_date && end_date < start_date
|
||||||
errors.add :end_date, :greater_than_start_date
|
errors.add :end_date, :greater_than_start_date
|
||||||
|
|||||||
@@ -26,6 +26,11 @@ class ContractTest < ActiveSupport::TestCase
|
|||||||
end
|
end
|
||||||
|
|
||||||
should "QUESTION: name be unique"
|
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
|
end
|
||||||
Reference in new issue
Block a user