Sha256: 65f5e33001f674dd7910d2d76f37f93d9a41c12397269ae29b8b81692a0640e1
Contents?: true
Size: 1.03 KB
Versions: 4
Compression:
Stored size: 1.03 KB
Contents
require 'bundler' Bundler.require(:default, :test) require 'mongoid' require 'active_model_serializers_cancancan' require 'rspec/its' Mongoid.configure do |config| config.connect_to "ams-test" end Mongo::Logger.logger.level = ::Logger::FATAL class User include Mongoid::Document field :name has_many :projects has_many :categories end class Project include Mongoid::Document belongs_to :user, required: false belongs_to :category, required: false has_many :categories end class Category include Mongoid::Document belongs_to :user, required: false belongs_to :project, required: false has_many :projects end RSpec.configure do |config| config.before(:each) do user1 = User.create!(id: 1, name: "User1") user2 = User.create!(id: 2, name: "User2") c = Category.create!(project: Project.create!(user: user2)) Project.create!(user: user1, category: c) Project.create!(user: user2, category: c) end config.after(:each) do User.delete_all Project.delete_all Category.delete_all end end
Version data entries
4 entries across 4 versions & 1 rubygems