mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-25 07:16:41 +00:00
Exit restriction validation on first restriction error
This commit is contained in:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user