spec/spec_helper.rb in mongoa-0.1.17 vs spec/spec_helper.rb in mongoa-0.2.1
- old
+ new
@@ -18,9 +18,22 @@
end
require 'mongoa'
require File.expand_path(File.dirname(__FILE__) + '/../lib/mongoa/mongo_mapper/matchers')
+class User
+ include MongoMapper::Document
+
+ key :name, String
+ key :email, String
+ key :years_alive, Integer
+ key :years_alive_numeric, Integer, :numeric => true
+ key :email_format, String, :format => /(\A(\s*)\Z)|(\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z)/i
+
+ validates_format_of :email, :with => /(\A(\s*)\Z)|(\A([^@\s]+)@((?:[-a-z0-9]+\.)+[a-z]{2,})\Z)/i
+ validates_numericality_of :years_alive
+end
+
class Post
include MongoMapper::Document
key :name, String
key :unique_name, String
\ No newline at end of file