refactored restrictions validation into own method

added validates_*type methods for forcing the value type used when doing restriction validation
This commit is contained in:
Adam Meehan
2008-07-01 11:31:17 +10:00
parent a27e4172a7
commit d035de1d7c
2 changed files with 72 additions and 49 deletions

View File

@@ -4,8 +4,8 @@ describe ValidatesTimeliness::Validations do
describe "with no restrictions" do
before :all do
class BasicValidation < Person
validates_timeliness_of :birth_date_and_time, :allow_blank => true
validates_timeliness_of :birth_date, :allow_blank => true
validates_timeliness_of :birth_date_and_time, :allow_blank => true, :type => :datetime
validates_timeliness_of :birth_date, :allow_blank => true, :type => :date
end
end
@@ -140,7 +140,7 @@ describe ValidatesTimeliness::Validations do
describe "with on_or_before and on_or_after restrictions" do
before :all do
class DateOnOrBeforeAndAfter < Person
validates_timeliness_of :birth_date, :on_or_before => 1.day.from_now.to_date, :on_or_after => 1.day.ago.to_date
validates_timeliness_of :birth_date, :on_or_before => 1.day.from_now.to_date, :on_or_after => 1.day.ago.to_date, :type => :date
end
end