forked from softace/validates_timeliness
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
62 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,30 +1,30 @@ | ||
require 'spec_helper' | ||
|
||
describe ValidatesTimeliness, 'HelperMethods' do | ||
let(:record) { Person.new } | ||
|
||
it 'should define class validation methods' do | ||
Person.should respond_to(:validates_date) | ||
Person.should respond_to(:validates_time) | ||
Person.should respond_to(:validates_datetime) | ||
end | ||
|
||
it 'should define instance validation methods' do | ||
Person.new.should respond_to(:validates_date) | ||
Person.new.should respond_to(:validates_time) | ||
Person.new.should respond_to(:validates_datetime) | ||
record.should respond_to(:validates_date) | ||
record.should respond_to(:validates_time) | ||
record.should respond_to(:validates_datetime) | ||
end | ||
|
||
it 'should validate instance using class validation defined' do | ||
Person.validates_date :birth_date | ||
r = Person.new | ||
r.valid? | ||
record.valid? | ||
|
||
r.errors[:birth_date].should_not be_empty | ||
record.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 | ||
record.validates_date :birth_date | ||
|
||
r.errors[:birth_date].should_not be_empty | ||
record.errors[:birth_date].should_not be_empty | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters