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.1.0 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.0.6 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.0.5 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.0.4 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.0.3 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.0.2 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.0.1 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-1.0.0 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.12.0 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.9 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.8 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.7 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.6 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.5 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.4 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.3 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.2 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.1 spec/unit/mongoid/commands/destroy_all_spec.rb
mongoid-0.11.0 spec/unit/mongoid/commands/destroy_all_spec.rb