Sha256: fb511feeafc0963d80459181563502ca259bc4a7b78cf1f90c7bbad832f3bfe5

Contents?: true

Size: 675 Bytes

Versions: 6

Compression:

Stored size: 675 Bytes

Contents

require 'database_cleaner/truncation_base'

module DatabaseCleaner
  module CouchPotato
    class Truncation < DatabaseCleaner::TruncationBase
      def initialize(options = {})
        if options.has_key?(:only) || options.has_key?(:except)
          raise ArgumentError, "The :only and :except options are not available for use with CouchPotato/CouchDB."
        elsif !options.empty?
          raise ArgumentError, "Unsupported option. You specified #{options.keys.join(',')}."
        end
        super
      end

      def clean
        database.recreate!
      end

      private

      def database
        ::CouchPotato.couchrest_database
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 4 rubygems

Version Path
bitfluent-database_cleaner-0.5.2 lib/database_cleaner/couch_potato/truncation.rb
database_cleaner-0.5.2 lib/database_cleaner/couch_potato/truncation.rb
database_cleaner-0.5.1 lib/database_cleaner/couch_potato/truncation.rb
jonrowe-database_cleaner-0.5.2 lib/database_cleaner/couch_potato/truncation.rb
saimonmoore-database_cleaner-0.5.0 lib/database_cleaner/couch_potato/truncation.rb
database_cleaner-0.5.0 lib/database_cleaner/couch_potato/truncation.rb