Sha256: fb14ee957bf67e70c094a78a5405e0286bd60973cc63090f8375ae844a714dc1

Contents?: true

Size: 598 Bytes

Versions: 2

Compression:

Stored size: 598 Bytes

Contents

require "spec_helper"

describe Mongoid::Commands::DestroyAll do

  describe "#execute" do

    before do
      @doc = mock
      @docs = [@doc]
      @klass = stub(:name => "Person")
      @conditions = { :conditions => { :title => "Sir" } }
      @expected = { :conditions => { :title => "Sir", :_type => "Person" } }
    end

    it "destroys each document that the criteria finds" do
      @klass.expects(:find).with(:all, @expected).returns(@docs)
      Mongoid::Commands::Destroy.expects(:execute).with(@doc)
      Mongoid::Commands::DestroyAll.execute(@klass, @conditions)
    end
  end
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mongoid-pre-2.0.0.beta1 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-2.0.0.alpha spec/unit/mongoid/commands/destroy_all_spec.rb