I am working on a Mongoid 3.0 port of carrierwave-mongoid. The specs
drop a collection that may or may not exist, but I am getting an error if
the collection does not exist. Please let me know if this is the expected
behavior or a bug.
You can see the spec I am working on here:
I drop a collection like this:
MongoUser.collection.drop
If the collection does not exist I get:
Moped::Errors::OperationFailure:
The operation: #<Moped::Protocol::Command
@length=71
@request_id=36
@response_to=0
@op_code=2004
@flags=[:slave_ok]
@full_collection_name="carrierwave_test.$cmd"
@skip=0
@limit=-1
@selector={:drop=>:users}
@fields=nil>
failed with error "ns not found"
# ./spec/mongoid_spec.rb:50:in `block (2 levels) in <top (required)>'
In the spec you can see that I am currently doing a workaround that is
insufficient going forward:
describe CarrierWave::Mongoid do
after do
if MongoUser.all.size > 0
MongoUser.collection.drop
end
end
...
Please let me know if this behavior is expected or a bug.
Best,
Andy