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.12.0 test/support/teardown.rb
gotime-cassandra_object-4.11.6 test/support/teardown.rb
gotime-cassandra_object-4.11.5 test/support/teardown.rb
gotime-cassandra_object-4.11.4 test/support/teardown.rb
gotime-cassandra_object-4.11.3 test/support/teardown.rb
gotime-cassandra_object-4.11.2 test/support/teardown.rb
gotime-cassandra_object-4.11.1 test/support/teardown.rb
gotime-cassandra_object-4.11.0 test/support/teardown.rb
gotime-cassandra_object-4.10.5 test/support/teardown.rb
gotime-cassandra_object-4.10.4 test/support/teardown.rb
gotime-cassandra_object-4.10.3 test/support/teardown.rb
gotime-cassandra_object-4.10.2 test/support/teardown.rb
gotime-cassandra_object-4.10.1 test/support/teardown.rb
cassandra_object_rails-0.0.1 test/support/teardown.rb
gotime-cassandra_object-4.10.0 test/support/teardown.rb
gotime-cassandra_object-4.9.2 test/support/teardown.rb
gotime-cassandra_object-4.9.1 test/support/teardown.rb
gotime-cassandra_object-4.9.0 test/support/teardown.rb
gotime-cassandra_object-4.8.1 test/support/teardown.rb
gotime-cassandra_object-4.8.0 test/support/teardown.rb