validates_timeliness/spec/validates_timeliness/helper_methods_spec.rb
Adam Meehan 34a2d4b558 methods for validated attributes for write cache and before type cast
cache raw value in @attributes_cache which is AR convention but should
work fine with non-AR ORM
before type cast method for reading back cached raw value
2010-08-03 15:01:57 +10:00

23 lines
872 B
Ruby

require 'spec_helper'
describe ValidatesTimeliness::HelperMethods do
it 'should define class validation methods on extended classes' do
ActiveRecord::Base.should respond_to(:validates_date)
ActiveRecord::Base.should respond_to(:validates_time)
ActiveRecord::Base.should respond_to(:validates_datetime)
end
it 'should define instance validation methods on extended classes' do
ActiveRecord::Base.instance_methods.should include('validates_date')
ActiveRecord::Base.instance_methods.should include('validates_time')
ActiveRecord::Base.instance_methods.should include('validates_datetime')
end
describe ".timeliness_validated_attributes" do
it 'should return attributes validated with plugin validator' do
Person.validates_date :birth_date
Person.timeliness_validated_attributes.should == ["birth_date"]
end
end
end