Sha256: 7a854db7468f7bf9f3e9aa8c3310ea9467097a645d64f3dfa4927d54fb9d42c7

Contents?: true

Size: 1.21 KB

Versions: 4

Compression:

Stored size: 1.21 KB

Contents

# $LOAD_PATH.unshift(File.dirname(__FILE__))
# $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
require 'rubygems'
require 'mongo_mapper'
require 'mongo_mapper/plugins'
require 'mongo_mapper/plugins/associations'

config = {
    'test' => {'host' => 'localhost', 'port' => 27017, 'database' => 'mongoa_test'},
}

MongoMapper.config = config
MongoMapper.connect("test")

require 'rspec'

Rspec.configure do |config|
end

require 'mongoa'
require File.expand_path(File.dirname(__FILE__) + '/../lib/mongoa/mongo_mapper/matchers')

class Post
  include MongoMapper::Document
  
  key :name, String
  key :unique_name, String
  
  validates_presence_of :name
  validates_length_of :name, :minimum => 4, :maximum => 32
  validates_uniqueness_of :unique_name
end

class PostRequired
  include MongoMapper::Document
  
  key :name, String, :required => true, :length => 32
  key :unique_name, String, :unique => true
  key :range_name, String, :required => true, :length => 0..56
end

class Within
  include MongoMapper::Document
  
  key :state, String
  
  validates_inclusion_of :state, :within => ["new", "uploaded"]
end

class WithinIn
  include MongoMapper::Document
  
  key :state, String, :in => ["new", "uploaded"]
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoa-0.1.17 spec/spec_helper.rb
mongoa-0.1.16 spec/spec_helper.rb
mongoa-0.1.15 spec/spec_helper.rb
mongoa-0.1.14 spec/spec_helper.rb