Sha256: 4635dc8fec40262e120a6770de4e8974c71333e34f9a574d31c483b3c8850de0
Contents?: true
Size: 1.91 KB
Versions: 41
Compression:
Stored size: 1.91 KB
Contents
require 'spec_helper' module MongoModel specs_for(Document, EmbeddedDocument) do describe "#inspect" do context "on base class" do it "should return class name" do described_class.inspect.should == described_class.name end end context "on subclasses" do context "without properties" do define_class(:TestDocument, described_class) it "should return class name" do TestDocument.inspect.should == 'TestDocument()' end end context "with properties" do define_class(:TestDocument, described_class) do property :name, String property :age, Integer end it "should return class name and property definitions" do TestDocument.inspect.should == 'TestDocument(name: String, age: Integer)' end end end end end specs_for(Document) do describe "#inspect" do context "on subclass instances" do define_class(:TestDocument, Document) do property :name, String property :age, Integer end subject { TestDocument.new(:id => 'abc-123', :name => 'Doc name', :age => 54) } it "should return class name and property values" do subject.inspect.should == '#<TestDocument id: abc-123, name: "Doc name", age: 54>' end end end end specs_for(EmbeddedDocument) do describe "#inspect" do context "on subclass instances" do define_class(:TestDocument, EmbeddedDocument) do property :name, String property :age, Integer end subject { TestDocument.new(:name => 'Doc name', :age => 54) } it "should return class name and property values" do subject.inspect.should == '#<TestDocument name: "Doc name", age: 54>' end end end end end
Version data entries
41 entries across 41 versions & 1 rubygems