Permalink
Browse files

Added ability to pass driver options to #remove.

  • Loading branch information...
1 parent 680cf2f commit f1c2f52c1e9a73bfdcda1f472fcb6c0c80f6ac75 @jnunemaker jnunemaker committed May 28, 2011
Showing with 6 additions and 2 deletions.
  1. +2 −2 lib/plucky/query.rb
  2. +4 −0 test/plucky/test_query.rb
View
@@ -85,9 +85,9 @@ def each
find_each.each { |doc| yield(doc) }
end
- def remove(opts={})
+ def remove(opts={}, driver_opts={})
query = clone.amend(opts)
- query.collection.remove(query.criteria.to_hash)
+ query.collection.remove(query.criteria.to_hash, driver_opts)
end
def count(opts={})
@@ -300,6 +300,10 @@ class QueryTest < Test::Unit::TestCase
lambda { Query.new(@collection).remove(:age.lte => 28) }.should change { @collection.count }
end
+ should "work with options" do
+ lambda { Query.new(@collection).remove({:age.lte => 28}, :safe => true) }.should change { @collection.count }
+ end
+
should "not modify original query object" do
query = Query.new(@collection)
query.remove(:name => 'Steve')

0 comments on commit f1c2f52

Please sign in to comment.