Sha256: 7b774d2300a54258e75a6887c31a8cbb7352fc69394b8a89d7bd77ff285f0d8c

Contents?: true

Size: 700 Bytes

Versions: 4

Compression:

Stored size: 700 Bytes

Contents

require 'test_helper'

class InspectTest < Test::Unit::TestCase
  context "#inspect" do
    setup do
      @document = Doc('User') do
        key :name,  String
        key :age,   Integer
        key :email, String
      end

      @doc = @document.new(:name => 'John', :age => 29)
    end

    should "print out non-nil attributes in alpha sorted order" do
      @doc.inspect.should =~ /_id:.*, age: 29, name: "John"/
    end
    
    should "print out all attributes when (optional) include_super argument is true" do
      @doc.inspect(true).should =~ /_id:.*, age: 29, email: nil, name: "John"/
    end

    should "include class name" do
      @doc.inspect.should =~ /^#<User/
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
mongo_mapper-0.11.0 test/unit/test_inspect.rb
mongo_mapper-0.10.1 test/unit/test_inspect.rb
mongo_mapper-0.10.0 test/unit/test_inspect.rb
mongo_mapper-0.9.2 test/unit/test_inspect.rb