Created
February 15, 2010 21:18
-
-
Save theconektd/305005 to your computer and use it in GitHub Desktop.
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
require "rubygems" | |
require "dm-core" | |
require "dm-validations" | |
require "spec" | |
class Contact | |
include DataMapper::Resource | |
property :id, Serial | |
property :email, String, :format => :email_address, :required => true | |
end | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
DataMapper.auto_migrate! | |
describe Contact do | |
it 'requires a valid email address' do | |
Contact.create(:email => nil).should_not be_valid | |
Contact.create(:email => 'foo').should_not be_valid | |
Contact.create(:email => 'foo@foo').should_not be_valid # This should pass | |
Contact.create(:email => '[email protected]').should be_valid | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment