mirror of
https://github.com/DatabaseCleaner/database_cleaner
synced 2023-03-27 23:22:03 -04:00
truncation support for CouchPotato / CouchDB
This commit is contained in:
parent
6ef3085bd4
commit
efe6bfc9a7
9 changed files with 103 additions and 4 deletions
21
examples/lib/couchpotato.rb
Normal file
21
examples/lib/couchpotato.rb
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
require 'couch_potato'
|
||||
|
||||
::CouchPotato::Config.database_name = 'couch_potato_test'
|
||||
|
||||
class Widget
|
||||
include CouchPotato::Persistence
|
||||
|
||||
property :name
|
||||
view :by_name, :key => :name
|
||||
|
||||
|
||||
# mimic the AR interface used in example_steps
|
||||
|
||||
def self.create!(attrs = {})
|
||||
CouchPotato.database.save(self.new)
|
||||
end
|
||||
|
||||
def self.count
|
||||
CouchPotato.database.view(::Widget.by_name).size
|
||||
end
|
||||
end
|
||||
Loading…
Add table
Add a link
Reference in a new issue