Sha256: e3b22f2e844abe9f0705466838659fb701cf3b5eafb1c4e20e61763c24225f80
Contents?: true
Size: 1.12 KB
Versions: 1
Compression:
Stored size: 1.12 KB
Contents
require 'spec_helper' describe ValidatesTimeliness::AttributeMethods do it 'should define _timeliness_raw_value_for instance method' do Person.instance_methods.should include('_timeliness_raw_value_for') end context "attribute write method" do class EmployeeCopy < ActiveRecord::Base set_table_name 'employees' validates_datetime :birth_datetime end it 'should cache attribute raw value' do r = EmployeeCopy.new r.birth_datetime = date_string = '2010-01-01' r._timeliness_raw_value_for(:birth_datetime).should == date_string end end context "before_type_cast method" do it 'should be defined on class if ORM supports it' do Employee.instance_methods(false).should include("birth_datetime_before_type_cast") end it 'should not be defined if ORM does not support it' do Person.instance_methods(false).should_not include("birth_datetime_before_type_cast") end it 'should return original value' do r = Employee.new r.birth_datetime = date_string = '2010-01-01' r.birth_datetime_before_type_cast.should == date_string end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
validates_timeliness-3.0.0.beta | spec/validates_timeliness/attribute_methods_spec.rb |