Changed validation error message on wrong milestone dates

This commit is contained in:
Xurxo Méndez Pérez 2017-11-18 19:22:11 +01:00
parent 6675bab599
commit b3a5abe4ae
3 changed files with 7 additions and 2 deletions

View File

@ -256,7 +256,7 @@ class Milestone < ActiveRecord::Base
def start_date_should_be_less_than_due_date
if due_date <= start_date
errors.add(:start_date, "Can't be greater than due date")
errors.add(:due_date, "must be greater than start date")
end
end

View File

@ -0,0 +1,5 @@
---
title: Changed validation error message on wrong milestone dates
merge_request:
author: Xurxo Méndez Pérez
type: fixed

View File

@ -11,7 +11,7 @@ describe Milestone do
milestone = build(:milestone, start_date: Date.tomorrow, due_date: Date.yesterday)
expect(milestone).not_to be_valid
expect(milestone.errors[:start_date]).to include("Can't be greater than due date")
expect(milestone.errors[:due_date]).to include("must be greater than start date")
end
end
end