Exit restriction validation on first restriction error

This commit is contained in:
Adam Meehan
2011-02-24 07:58:48 +11:00
parent 2244d5e74d
commit 2822e368e3
2 changed files with 18 additions and 4 deletions

View File

@@ -136,7 +136,7 @@ describe ValidatesTimeliness::Validator do
let(:person) { Person.new(:birth_date => Date.today) }
before do
Person.validates_time :birth_date, :is_at => lambda { raise }
Person.validates_time :birth_date, :is_at => lambda { raise }, :before => lambda { raise }
end
it "should be added when ignore_restriction_errors is false" do
@@ -152,6 +152,13 @@ describe ValidatesTimeliness::Validator do
person.errors[:birth_date].should be_empty
end
end
it 'should exit on first error' do
with_config(:ignore_restriction_errors, false) do
person.valid?
person.errors[:birth_date].should have(1).items
end
end
end
describe "#format_error_value" do