Sha256: 7c356b7bd8098498f017aebd88e2a9285dd0a066cd7811ad377b125c81de185f
Contents?: true
Size: 668 Bytes
Versions: 15
Compression:
Stored size: 668 Bytes
Contents
require "spec_helper" describe Mongoid::Factory do describe ".build" do context "when the _type attribute is present" do before do @attributes = { "_type" => "Person", "title" => "Sir" } end it "instantiates based on the type" do person = Mongoid::Factory.build(Person, @attributes) person.title.should == "Sir" end end context "when _type is not preset" do before do @attributes = { "title" => "Sir" } end it "instantiates based on the type" do person = Mongoid::Factory.build(Person, @attributes) person.title.should == "Sir" end end end end
Version data entries
15 entries across 15 versions & 3 rubygems