Sha256: 26a5d5d2fedd25dd0f9386acc6a3f87866fd010e1fa65044e29a585be014a2a5

Contents?: true

Size: 860 Bytes

Versions: 2

Compression:

Stored size: 860 Bytes

Contents

require 'test_helper'

module Acts::Slugoid::Test

  class TestMongoidFinder < Test::Unit::TestCase

    include Config
    alias :setup! :setup

    def setup
      setup!
      @slugoid_project = SlugoidProject.create!(:name => 'Scott')
      @project = Project.create!
    end

    context "find" do
      should "return the objects when you pass the id" do
        assert_equal(@slugoid_project, SlugoidProject.find(@slugoid_project.to_param))
        assert_equal(@slugoid_project, SlugoidProject.find(@slugoid_project.id))
      end
    end

    context "explicit find by id" do
      should "return the object" do
        assert_equal(@slugoid_project, SlugoidProject.where(:_id => @slugoid_project.id).first)
        assert_equal(@slugoid_project, SlugoidProject.find(:first, :conditions => {:_id => @slugoid_project.id}))
      end
    end

  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
slugoid-0.1.0 test/unit/test_mongoid_finder.rb
slugoid-0.0.5 test/unit/test_mongoid_finder.rb