From 969edfcb8332b5e1760cde90508cd4a4412f77e2 Mon Sep 17 00:00:00 2001 From: Adam Meehan Date: Sun, 7 Aug 2011 08:44:12 +1000 Subject: [PATCH] Helper method spec --- spec/validates_timeliness/helper_methods_spec.rb | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/spec/validates_timeliness/helper_methods_spec.rb b/spec/validates_timeliness/helper_methods_spec.rb index 0b05b4f..b4c5f33 100644 --- a/spec/validates_timeliness/helper_methods_spec.rb +++ b/spec/validates_timeliness/helper_methods_spec.rb @@ -13,9 +13,18 @@ describe ValidatesTimeliness, 'HelperMethods' do Person.new.should respond_to(:validates_datetime) end - it 'should validate instance when validation method called' do + it 'should validate instance using class validation defined' do + Person.validates_date :birth_date + r = Person.new + r.valid? + + r.errors[:birth_date].should_not be_empty + end + + it 'should validate instance using instance valiation method' do r = Person.new r.validates_date :birth_date + r.errors[:birth_date].should_not be_empty end end