Sha256: 6f9af1b66bf1c635d0260c118afc6dadea307c5cf84afe9ae89771a204806743

Contents?: true

Size: 481 Bytes

Versions: 27

Compression:

Stored size: 481 Bytes

Contents

CassandraObject::Base.class_eval do
  class_attribute :created_records
  self.created_records = []

  after_create do
    created_records << self
  end

  def self.delete_after_test
    # created_records.reject(&:destroyed?).each(&:destroy)
    Issue.delete_all
    created_records.clear
  end
end

module ActiveSupport
  class TestCase
    teardown do
      if CassandraObject::Base.created_records.any?
        CassandraObject::Base.delete_after_test
      end
    end
  end
end

Version data entries

27 entries across 27 versions & 2 rubygems

Version Path
gotime-cassandra_object-4.7.3 test/support/teardown.rb
gotime-cassandra_object-4.7.2 test/support/teardown.rb
gotime-cassandra_object-4.7.1 test/support/teardown.rb
gotime-cassandra_object-4.7.0 test/support/teardown.rb
gotime-cassandra_object-4.6.0 test/support/teardown.rb
gotime-cassandra_object-4.5.1 test/support/teardown.rb
gotime-cassandra_object-4.4.5 test/support/teardown.rb