Sha256: 61ffdba2c5ddbdf66b640141c35e5fbee20d9b843a82ee625f2381b31a0420dc

Contents?: true

Size: 434 Bytes

Versions: 6

Compression:

Stored size: 434 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)
    created_records.clear
  end
end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gotime-cassandra_object-4.4.3 test/support/teardown.rb
gotime-cassandra_object-4.4.0 test/support/teardown.rb
gotime-cassandra_object-4.3.2 test/support/teardown.rb
gotime-cassandra_object-4.3.1 test/support/teardown.rb
gotime-cassandra_object-4.3.0 test/support/teardown.rb
gotime-cassandra_object-4.2.2 test/support/teardown.rb