allowing 0 values for story points

pull/6827/head
Gregor Schmidt 14 years ago
parent 689326fcdf
commit 2c02984721
  1. 8
      lib/backlogs_issue_patch.rb
  2. 13
      spec/models/issue_spec.rb

@ -14,10 +14,10 @@ module Backlogs
before_validation :backlogs_before_validation, :if => lambda {|i| i.project && i.project.module_enabled?("backlogs")}
after_save :backlogs_after_save
validates_numericality_of :story_points, :only_integer => true,
:allow_nil => true,
:greater_than => 0,
:less_than => 10_000,
validates_numericality_of :story_points, :only_integer => true,
:allow_nil => true,
:greater_than_or_equal_to => 0,
:less_than => 10_000,
:if => lambda { |i| i.project && i.project.module_enabled?('backlogs') }
end

@ -27,7 +27,10 @@ describe Issue do
issue.should be_valid
end
it 'allows values greater than 0' do
it 'allows values greater than or equal to 0' do
issue.story_points = '0'
issue.should be_valid
issue.story_points = '1'
issue.should be_valid
end
@ -42,14 +45,6 @@ describe Issue do
issue.should_not be_valid
end
it 'disallows 0 and negative values' do
issue.story_points = '0'
issue.should_not be_valid
issue.story_points = '-1'
issue.should_not be_valid
end
it 'disallows greater or equal than 10.000' do
issue.story_points = '10000'
issue.should_not be_valid

Loading…
Cancel
Save