Sha256: 1da02a8701cdb4c31d894dcbb4ebe8d5cd74f726da553423fa761c1efd655c05

Contents?: true

Size: 1.63 KB

Versions: 4

Compression:

Stored size: 1.63 KB

Contents

require 'rubygems'
require 'bundler'
begin
  groups = [:default, :development]
  if defined?(EM) && EM.reactor_running?
    groups << :async
  else
    groups << :sync
  end
  Bundler.setup(groups)
rescue Bundler::BundlerError => e
  $stderr.puts e.message
  $stderr.puts "Run `bundle install` to install missing gems"
  exit e.status_code
end
require 'test/unit'
require 'shoulda'

$LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
$LOAD_PATH.unshift(File.dirname(__FILE__))
require 'mongoo'

Mongoo.config = {host: "127.0.0.1", port: 27017, db: 'mongoo-test'}

class SearchIndex < Mongoo::Base
  attribute "terms", :type => :array
  index "terms"
end

class Person < Mongoo::Base
  attribute "name", :type => :string
  attribute "visits", :type => :integer
  attribute "interests", :type => :array
  attribute "jobs.total", :type => :integer
  attribute "jobs.professional", :type => :array
  attribute "jobs.volunteer", :type => :array
  attribute "jobs.internships.high_school", :type => :array
  attribute "location.city", :type => :string
  attribute "location.demographics.crime_rate", :type => :symbol
  attribute "location.demographics.education_quality", :type => :symbol
  attribute "misc", :type => :hash
  
  index "name"
  index "location.city"
end

class TvShow < Mongoo::Base
  attribute "name", :type => :string
  attribute "cast.director", :type => :string
  attribute "cast.lead", :type => :string
  attribute "rating", :type => :float
  attribute "comments", :type => :array
  
  index "name"
  
  validates_presence_of "name"
  validates_presence_of "cast.director"
  validates_presence_of "rating"
end

class Test::Unit::TestCase
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongoo-0.1.5 test/helper.rb
mongoo-0.1.4 test/helper.rb
mongoo-0.1.3 test/helper.rb
mongoo-0.1.2 test/helper.rb