mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
use namespaced validator class name for the :timeliness option
This commit is contained in:
parent
7b5b11ad63
commit
54ba4a038c
@ -86,4 +86,4 @@ module ValidatesTimeliness
|
|||||||
end
|
end
|
||||||
|
|
||||||
# Compatibility with ActiveModel validates method which matches option keys to their validator class
|
# Compatibility with ActiveModel validates method which matches option keys to their validator class
|
||||||
TimelinessValidator = ValidatesTimeliness::Validator
|
ActiveModel::Validations::TimelinessValidator = ValidatesTimeliness::Validator
|
||||||
|
|||||||
@ -12,10 +12,10 @@ describe ValidatesTimeliness::Validator do
|
|||||||
ValidatesTimeliness::Validator.kind.should == :timeliness
|
ValidatesTimeliness::Validator.kind.should == :timeliness
|
||||||
end
|
end
|
||||||
|
|
||||||
describe "Model.validates :timeliness option" do
|
describe "Model.validates with :timeliness option" do
|
||||||
it 'should use plugin validator class' do
|
it 'should use plugin validator class' do
|
||||||
Person.validates :birth_date, :timeliness => {:is_at => Date.new(2010,1,1), :type => :date}
|
Person.validates :birth_date, :timeliness => {:is_at => Date.new(2010,1,1), :type => :date}
|
||||||
Person.validators.should have(1).kind_of(TimelinessValidator)
|
Person.validators.should have(1).kind_of(ActiveModel::Validations::TimelinessValidator)
|
||||||
invalid!(:birth_date, Date.new(2010,1,2))
|
invalid!(:birth_date, Date.new(2010,1,2))
|
||||||
valid!(:birth_date, Date.new(2010,1,1))
|
valid!(:birth_date, Date.new(2010,1,1))
|
||||||
end
|
end
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user