mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
use activemodel scoped class name in helper method to remove need for .kind override
This commit is contained in:
parent
9d654b1122
commit
e3dea5aebd
@ -20,7 +20,7 @@ module ActiveModel
|
||||
self.timeliness_validated_attributes ||= []
|
||||
self.timeliness_validated_attributes += (attr_names - self.timeliness_validated_attributes)
|
||||
end
|
||||
validates_with ValidatesTimeliness::Validator, options
|
||||
validates_with TimelinessValidator, options
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
@ -22,10 +22,6 @@ module ValidatesTimeliness
|
||||
|
||||
RESTRICTION_ERROR_MESSAGE = "Error occurred validating %s for %s restriction:\n%s"
|
||||
|
||||
def self.kind
|
||||
:timeliness
|
||||
end
|
||||
|
||||
def initialize(options)
|
||||
@type = options.delete(:type) || :datetime
|
||||
@allow_nil, @allow_blank = options.delete(:allow_nil), options.delete(:allow_blank)
|
||||
|
||||
@ -7,10 +7,6 @@ describe ValidatesTimeliness::Validator do
|
||||
Timecop.freeze(Time.local_time(2010, 1, 1, 0, 0, 0))
|
||||
end
|
||||
|
||||
it 'should return validator kind as :timeliness' do
|
||||
ValidatesTimeliness::Validator.kind.should == :timeliness
|
||||
end
|
||||
|
||||
describe "Model.validates with :timeliness option" do
|
||||
it 'should use plugin validator class' do
|
||||
Person.validates :birth_date, :timeliness => {:is_at => Date.new(2010,1,1), :type => :date}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user