Sha256: 4798522229c26ce003d4177d07a3dc8a27ed02e7b3d0e9ccca513e8d0f994d10
Contents?: true
Size: 1.25 KB
Versions: 1
Compression:
Stored size: 1.25 KB
Contents
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 it 'should validate instance when validation method called' do r = Person.new r.validates_date :birth_date r.errors[:birth_date].should_not be_empty end describe ".timeliness_validated_attributes" do it 'should return attributes validated with plugin validator' do Person.timeliness_validated_attributes = {} Person.validates_date :birth_date Person.validates_time :birth_time Person.validates_datetime :birth_datetime Person.timeliness_validated_attributes.should == { "birth_date" => :date, "birth_time" => :time, "birth_datetime" => :datetime } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_timeliness-3.0.0.beta.3 | spec/validates_timeliness/helper_methods_spec.rb |