Sha256: 971f46fb30e0723bc8ccfb5d25126b6bad1e897d482cdf6472586bd8931c0862

Contents?: true

Size: 744 Bytes

Versions: 6

Compression:

Stored size: 744 Bytes

Contents

require 'test_helper'

class TestRailsCompatibility < Test::Unit::TestCase
  def setup
    @document = Class.new do
      include MongoMapper::Document
    end
  end

  should "have to_param that returns id" do
    instance = @document.create('_id' => '1234')
    instance.to_param.should == '1234'
  end

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

  should "alias many to has_many" do
    @document.should respond_to(:has_many)
    @document.method(:has_many).should == @document.method(:many)
  end

  should "have column names" do
    @document.key :fname, String
    @document.column_names.sort.should == ['_id', 'created_at', 'fname', 'updated_at']
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
crnixon-mongomapper-0.2.0 test/test_rails_compatibility.rb
fcoury-mongomapper-0.3.0 test/test_rails_compatibility.rb
fcoury-mongomapper-0.3.1 test/test_rails_compatibility.rb
fcoury-mongomapper-0.3.3 test/test_rails_compatibility.rb
jnunemaker-mongomapper-0.2.0 test/test_rails_compatibility.rb
ramsingla-mongomapper-0.2.1 test/test_rails_compatibility.rb