Sha256: f544139f9a9055646f261d6799ec02c3a08f88a47636254283c139407071e60c

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

require "spec_helper"

describe Mongoid::Finders do

  describe "#find" do

    before do
      @document = Person.create(:title => "Mrs.", :ssn => "another")
    end

    after do
      Person.delete_all
    end

    context "with an id as an argument" do

      context "when the document is found" do

        it "returns the document" do
          Person.find(@document.id).should == @document
        end

      end

      context "when the document is not found" do

        it "raises an error" do
          lambda { Person.find("5") }.should raise_error
        end

      end

    end

  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mongoid-1.1.1 spec/integration/mongoid/finders_spec.rb
mongoid-1.1.0 spec/integration/mongoid/finders_spec.rb