Skip to content

Commit

Permalink
Adding spec showing #1261 working.
Browse files Browse the repository at this point in the history
  • Loading branch information
durran committed Sep 23, 2011
1 parent 69de1f8 commit 8a753b6
Showing 1 changed file with 27 additions and 1 deletion.
28 changes: 27 additions & 1 deletion spec/functional/mongoid/criterion/inclusion_spec.rb
Expand Up @@ -3,7 +3,7 @@
describe Mongoid::Criterion::Inclusion do

before do
[ Person, Post, Product, Game ].each(&:delete_all)
[ Person, Post, Product, Game, Jar ].each(&:delete_all)
end

describe "#all_in" do
Expand Down Expand Up @@ -199,6 +199,32 @@

context "when finding by an array of ids" do

context "when ids are not object ids" do

let!(:jar_one) do
Jar.create(:_id => 114869287646134350)
end

let!(:jar_two) do
Jar.create(:_id => 114869287646134388)
end

let!(:jar_three) do
Jar.create(:_id => 114869287646134398)
end

context "when the documents are found" do

let(:jars) do
Jar.find([ jar_one.id, jar_two.id, jar_three.id ])
end

it "returns the documents from the database" do
jars.should eq([ jar_one, jar_two, jar_three ])
end
end
end

context "when the id is found" do

let!(:from_db) do
Expand Down

0 comments on commit 8a753b6

Please sign in to comment.