Sha256: 96d88d4b7d6f5fac0019bc68277185670409fcf652ffb4428159cff03b61016e
Contents?: true
Size: 1.07 KB
Versions: 17
Compression:
Stored size: 1.07 KB
Contents
module DatabaseCleaner module Generic module Truncation def initialize(opts={}) if !opts.empty? && !(opts.keys - [:only, :except]).empty? raise ArgumentError, "The only valid options are :only and :except. You specified #{opts.keys.join(',')}." end if opts.has_key?(:only) && opts.has_key?(:except) raise ArgumentError, "You may only specify either :only or :except. Doing both doesn't really make sense does it?" end @only = opts[:only] @tables_to_exclude = (opts[:except] || []).dup @tables_to_exclude << migration_storage_name if migration_storage_name end def start #included for compatability reasons, do nothing if you don't need to end def clean raise NotImplementedError end private def tables_to_truncate raise NotImplementedError end # overwrite in subclasses # default implementation given because migration storage need not be present def migration_storage_name nil end end end end
Version data entries
17 entries across 11 versions & 4 rubygems