Sha256: 46c5c292004d2a5cb4eec43c4b88d686689e4b1c923205ab1d2d35ca10e50a98
Contents?: true
Size: 1.08 KB
Versions: 15
Compression:
Stored size: 1.08 KB
Contents
require 'spec_helper' describe "Rails Compatibility" do module EmbeddedDocuments class Item include MongoMapper::EmbeddedDocument key :for_all, String end class FirstItem < Item key :first_only, String many :second_items end class SecondItem < Item key :second_only, String end end context "EmbeddedDocument" do it "should alias many to has_many" do EmbeddedDocuments::FirstItem.should respond_to(:has_many) end it "should alias one to has_one" do EmbeddedDocuments::FirstItem.should respond_to(:has_one) end it "should have column names" do EmbeddedDocuments::Item.column_names.sort.should == ['_id', '_type', 'for_all'] EmbeddedDocuments::FirstItem.column_names.sort.should == ['_id', '_type', 'first_only', 'for_all'] EmbeddedDocuments::SecondItem.column_names.sort.should == ['_id', '_type', 'for_all', 'second_only'] end it "should alias new to new_record?" do instance = EmbeddedDocuments::Item.new instance.new_record?.should == instance.new? end end end
Version data entries
15 entries across 15 versions & 1 rubygems