[#4177] Added validation for Contract to check that end date is greater than start date.

This commit is contained in:
Eric Davis
2010-06-17 12:34:27 -07:00
parent 8c7d865a60
commit 56e39ba3ca
2 changed files with 13 additions and 2 deletions
+7 -2
View File
@@ -16,8 +16,13 @@ class ContractTest < ActiveSupport::TestCase
should_allow_values_for :discount_type, "$", "%", nil, ''
should_not_allow_values_for :discount_type, ["amount", "percent", "bar"]
context "start_date" do
should "be before end_date"
context "end_date" do
should "be after start_date" do
@contract = Contract.new(:start_date => Date.today, :end_date => Date.yesterday)
assert @contract.invalid?
assert_equal "must be greater than start date", @contract.errors.on(:end_date)
end
end
should "QUESTION: name be unique"