Sha256: 23c47df1f2a01778996952634543deda29628454234362e8a28226b2bd9797b4

Contents?: true

Size: 694 Bytes

Versions: 1

Compression:

Stored size: 694 Bytes

Contents

require 'test_helper'

class TestRailsCompatibility < Test::Unit::TestCase
  class Item
    include MongoMapper::EmbeddedDocument
    key :for_all, String
  end
  
  class Order
    include MongoMapper::Document
    many :items, :class_name => 'TestRailsCompatibility::Item'
    key :order_only, String
  end
  
  context "Document" do
    setup do
      clear_all_collections
    end
  
    should "have to_param that returns id" do
      instance = Order.create('_id' => 1234)
      instance.to_param.should == '1234'
    end

    should "alias new to new_record?" do
      instance = Order.new
      instance.new_record?.should == instance.new?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
djsun-mongomapper-0.4.1.2 test/functional/test_rails_compatibility.rb