Sha256: 45602cb86f6dc35ffb25a75c86f1ac6d09865bc908b82e0802c85ce66d438494

Contents?: true

Size: 861 Bytes

Versions: 1

Compression:

Stored size: 861 Bytes

Contents

require 'test_helper'

module Acts::Sluggable::Test

  class TestMongoidFinder < Test::Unit::TestCase

    include Config
    alias :setup! :setup

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

    context "find" do
      should "return the objects when you pass the id" do
        assert_equal(@sluggable_project, SluggableProject.find(@sluggable_project.to_param))
        assert_equal(@project, Project.find(@project.id))
      end
    end

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

  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
acts_as_sluggable-0.0.3 test/unit/test_mongoid_finder.rb