mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-23 06:16:44 +00:00
add validator type accessor
This commit is contained in:
parent
7117a5ef22
commit
b22a7c41b8
@ -4,6 +4,8 @@ module ValidatesTimeliness
|
||||
class Validator < ActiveModel::EachValidator
|
||||
include Conversion
|
||||
|
||||
attr_reader :type
|
||||
|
||||
RESTRICTIONS = {
|
||||
:is_at => :==,
|
||||
:before => :<,
|
||||
|
||||
@ -22,7 +22,7 @@ describe ValidatesTimeliness::Validator do
|
||||
|
||||
it 'should use default to :datetime type' do
|
||||
Person.validates :birth_datetime, :timeliness => {:is_at => Time.mktime(2010,1,1)}
|
||||
Person.validators.first.instance_variable_get(:@type).should == :datetime
|
||||
Person.validators.first.type.should == :datetime
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user