# encoding: utf-8 require 'spec_helper' # # The case # class Author include Mongoid::Document field :name, type: String has_many :books end class Book include Mongoid::Document include Mongoid::Max::Denormalize field :name, type: String belongs_to :author has_many :reviews end class Review include Mongoid::Document include Mongoid::Max::Denormalize belongs_to :book field :rating, type: Integer end # # The specs # describe "Case: Existing" do before do @author = Author.create!(name: "Michael Crichton") @book = Book.create!(name: "Jurassic Park", author: @author) @review_1 = Review.create!(book: @book, rating: 4) @review_2 = Review.create!(book: @book, rating: 5) end context "when defining the denormalization" do before do Book.denormalize :author, :name Book.denormalize :reviews, :rating, :count => true Review.denormalize :book, :name end it "denormalization should be empty" do end end end