Forked from theconektd/dm-validations-email_format.rb
Created
November 7, 2010 19:47
-
-
Save andrewkolesnikov/666360 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-tags" | |
require "dm-validations" | |
require "spec" | |
class Contact | |
include DataMapper::Resource | |
property :id, Serial | |
has_tags_on :tags | |
end | |
DataMapper.setup(:default, 'sqlite3::memory:') | |
DataMapper.auto_migrate! | |
describe Contact do | |
it 'requires a tags be saved even when tags are malformed' do | |
Contact.create(:tag_list => ',foo,bar').should be_valid # never executes sql queries, because validation failed, although no errors are raised. | |
Tag.errors.length.should == 0 #fails | |
Contact.first.tag_collection.should == 'foo,bar' #fails | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment