-
-
Notifications
You must be signed in to change notification settings - Fork 196
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'rails-3-develop' of ssh://git.mysociety.org/data/git/pu…
…blic/alaveteli into rails-3-develop
- Loading branch information
Showing
8 changed files
with
160 additions
and
6 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
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
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,53 @@ | ||
require File.expand_path(File.dirname(__FILE__) + '/../spec_helper') | ||
|
||
describe AboutMeValidator do | ||
|
||
describe :new do | ||
|
||
it 'sets each supported attribute on the instance' do | ||
params = { :about_me => 'My description' } | ||
validator = AboutMeValidator.new(params) | ||
expect(validator.about_me).to eq('My description') | ||
end | ||
|
||
end | ||
|
||
describe :valid? do | ||
|
||
it 'is valid if about_me is =< 500' do | ||
params = { :about_me => 'a'*500 } | ||
validator = AboutMeValidator.new(params) | ||
expect(validator).to be_valid | ||
end | ||
|
||
it 'is valid if about_me is blank' do | ||
params = { :about_me => '' } | ||
validator = AboutMeValidator.new(params) | ||
expect(validator).to be_valid | ||
end | ||
|
||
it 'is valid if about_me is nil' do | ||
params = { :about_me => nil } | ||
validator = AboutMeValidator.new(params) | ||
expect(validator).to be_valid | ||
end | ||
|
||
it 'is invalid if about_me is > 500' do | ||
params = { :about_me => 'a'*501 } | ||
validator = AboutMeValidator.new(params) | ||
expect(validator).to have(1).error_on(:about_me) | ||
end | ||
|
||
end | ||
|
||
describe :about_me do | ||
|
||
it 'has an attribute accessor' do | ||
params = { :about_me => 'My description' } | ||
validator = AboutMeValidator.new(params) | ||
expect(validator.about_me).to eq('My description') | ||
end | ||
|
||
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