mirror of
https://github.com/ditkrg/validates_timeliness.git
synced 2026-01-22 22:06:45 +00:00
ruby 1.9.2 spec fixes for instance method checks
This commit is contained in:
parent
1e48173e6a
commit
316086e76f
@ -2,7 +2,7 @@ require 'spec_helper'
|
||||
|
||||
describe ValidatesTimeliness::AttributeMethods do
|
||||
it 'should define _timeliness_raw_value_for instance method' do
|
||||
PersonWithShim.instance_methods.should include('_timeliness_raw_value_for')
|
||||
PersonWithShim.new.should respond_to(:_timeliness_raw_value_for)
|
||||
end
|
||||
|
||||
describe ".timeliness_validated_attributes" do
|
||||
@ -70,7 +70,7 @@ describe ValidatesTimeliness::AttributeMethods do
|
||||
|
||||
context "before_type_cast method" do
|
||||
it 'should not be defined if ORM does not support it' do
|
||||
PersonWithShim.instance_methods(false).should_not include("birth_datetime_before_type_cast")
|
||||
PersonWithShim.new.should_not respond_to(:birth_datetime_before_type_cast)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@ -8,9 +8,9 @@ describe ValidatesTimeliness, 'HelperMethods' do
|
||||
end
|
||||
|
||||
it 'should define instance validation methods' do
|
||||
Person.instance_methods.should include('validates_date')
|
||||
Person.instance_methods.should include('validates_time')
|
||||
Person.instance_methods.should include('validates_datetime')
|
||||
Person.new.should respond_to(:validates_date)
|
||||
Person.new.should respond_to(:validates_time)
|
||||
Person.new.should respond_to(:validates_datetime)
|
||||
end
|
||||
|
||||
it 'should validate instance when validation method called' do
|
||||
|
||||
@ -10,9 +10,9 @@ describe ValidatesTimeliness, 'ActiveRecord' do
|
||||
end
|
||||
|
||||
it 'should defines for the instance' 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')
|
||||
Employee.new.should respond_to(:validates_date)
|
||||
Employee.new.should respond_to(:validates_time)
|
||||
Employee.new.should respond_to(:validates_datetime)
|
||||
end
|
||||
end
|
||||
|
||||
@ -73,7 +73,7 @@ describe ValidatesTimeliness, 'ActiveRecord' do
|
||||
|
||||
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")
|
||||
Employee.new.should respond_to(:birth_datetime_before_type_cast)
|
||||
end
|
||||
|
||||
it 'should return original value' do
|
||||
|
||||
@ -34,9 +34,9 @@ describe ValidatesTimeliness, 'Mongoid' do
|
||||
end
|
||||
|
||||
it 'should be defined on the instance' do
|
||||
Article.instance_methods.should include('validates_date')
|
||||
Article.instance_methods.should include('validates_time')
|
||||
Article.instance_methods.should include('validates_datetime')
|
||||
Article.new.should respond_to(:validates_date)
|
||||
Article.new.should respond_to(:validates_time)
|
||||
Article.new.should respond_to(:validates_datetime)
|
||||
end
|
||||
end
|
||||
|
||||
@ -85,7 +85,7 @@ describe ValidatesTimeliness, 'Mongoid' do
|
||||
|
||||
context "before_type_cast method" do
|
||||
it 'should not be defined if ORM does not support it' do
|
||||
Article.instance_methods(false).should_not include("birth_datetime_before_type_cast")
|
||||
Article.new.should_not respond_to(:birth_datetime_before_type_cast)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Loading…
Reference in New Issue
Block a user