Sha256: bcd12b2784060db7956d18f8978120e7930901341b101573393eae5d7ef60e3a
Contents?: true
Size: 893 Bytes
Versions: 13
Compression:
Stored size: 893 Bytes
Contents
require "spec_helper" describe Mongoid::Commands::DeleteAll do describe "#execute" do before do @doc = mock @docs = [@doc] @klass = mock end context "when conditions supplied" do before do @conditions = { :conditions => { :title => "Sir" } } end it "deletes each document that the criteria finds" do @klass.expects(:find).with(:all, @conditions).returns(@docs) Mongoid::Commands::Delete.expects(:execute).with(@doc) Mongoid::Commands::DeleteAll.execute(@klass, @conditions) end end context "when no conditions supplied" do before do @collection = mock end it "drops the collection" do @klass.expects(:collection).returns(@collection) @collection.expects(:drop) Mongoid::Commands::DeleteAll.execute(@klass) end end end end
Version data entries
13 entries across 13 versions & 1 rubygems