Sha256: 4a94067f256e39a395e7816f2639de4e3e582870d10c45d14bc4c7010f0b14d3

Contents?: true

Size: 600 Bytes

Versions: 39

Compression:

Stored size: 600 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

39 entries across 39 versions & 2 rubygems

Version Path
mongoid-1.2.14 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.13 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.12 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.11 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.10 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.9 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.8 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.7 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-pre-2.0.0.pre spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.6 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.5 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.4 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.3 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.2 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.1 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.2.0 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.1.4 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.1.3 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.1.2 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.1.1 spec/unit/mongoid/commands/destroy_all_spec.rb