mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
Add specs for allow_nil and allow_blank with attribute value cache active
This commit is contained in:
parent
3f4615e053
commit
4acd0180f9
@ -46,6 +46,17 @@ describe ValidatesTimeliness::Validator do
|
||||
Person.validates_date :birth_date, :allow_nil => true
|
||||
valid!(:birth_date, NIL)
|
||||
end
|
||||
|
||||
context "with raw value cache" do
|
||||
it "should not be valid with an invalid format" do
|
||||
PersonWithShim.validates_date :birth_date, :allow_nil => true
|
||||
|
||||
p = PersonWithShim.new
|
||||
p.birth_date = 'bogus'
|
||||
|
||||
p.should_not be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ":allow_blank option" do
|
||||
@ -59,6 +70,17 @@ describe ValidatesTimeliness::Validator do
|
||||
Person.validates_date :birth_date, :allow_blank => true
|
||||
valid!(:birth_date, '')
|
||||
end
|
||||
|
||||
context "with raw value cache" do
|
||||
it "should not be valid with an invalid format" do
|
||||
PersonWithShim.validates_date :birth_date, :allow_blank => true
|
||||
|
||||
p = PersonWithShim.new
|
||||
p.birth_date = 'bogus'
|
||||
|
||||
p.should_not be_valid
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
describe ":between option" do
|
||||
|
||||
Loading…
Reference in New Issue
Block a user