##// END OF EJS Templates
Negative estimated hours should not be valid (#12735)....
Jean-Philippe Lang -
r10895:45c93340b78d
parent child
Show More
@@ -67,7 +67,7 class Issue < ActiveRecord::Base
67 67
68 68 validates_length_of :subject, :maximum => 255
69 69 validates_inclusion_of :done_ratio, :in => 0..100
70 validates_numericality_of :estimated_hours, :allow_nil => true
70 validates :estimated_hours, :numericality => {:greater_than_or_equal_to => 0, :allow_nil => true, :message => :invalid}
71 71 validates :start_date, :date => true
72 72 validates :due_date, :date => true
73 73 validate :validate_issue, :validate_required_fields
@@ -79,6 +79,15 class IssueTest < ActiveSupport::TestCase
79 79 assert_include 'Due date must be greater than start date', issue.errors.full_messages
80 80 end
81 81
82 def test_estimated_hours_should_be_validated
83 set_language_if_valid 'en'
84 ['-2'].each do |invalid|
85 issue = Issue.new(:estimated_hours => invalid)
86 assert !issue.valid?
87 assert_include 'Estimated time is invalid', issue.errors.full_messages
88 end
89 end
90
82 91 def test_create_with_required_custom_field
83 92 set_language_if_valid 'en'
84 93 field = IssueCustomField.find_by_name('Database')
General Comments 0
You need to be logged in to leave comments. Login now