Sha256: 1bd420b1b85f2e5cd68059b235ae6567667d423b49d52476d3a4c0863ebe0416
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
require "spec_helper" describe Mongoid::Inspection do describe "#inspect" do context "when not allowing dynamic fields" do before do Mongoid.configure.allow_dynamic_fields = false end let(:person) do Person.new(title: "CEO") end let(:inspected) do person.inspect end it "includes the model type" do inspected.should include("#<Person") end it "displays the id" do inspected.should include("_id: #{person.id}") end it "displays defined fields" do inspected.should include("title: \"CEO\"") end it "displays field aliases" do inspected.should include("t(test):") end end context "when allowing dynamic fields" do let(:person) do Person.new(title: "CEO", some_attribute: "foo") end let(:inspected) do person.inspect end before do Mongoid.configure.allow_dynamic_fields = true end it "includes dynamic attributes" do inspected.should include("some_attribute: \"foo\"") end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
mongoid-3.1.7 | spec/mongoid/inspection_spec.rb |
mongoid-3.1.6 | spec/mongoid/inspection_spec.rb |
mongoid-3.1.5 | spec/mongoid/inspection_spec.rb |