Class: Cranium::TestFramework::DatabaseEntity

Inherits:
Object
  • Object
show all
Defined in:
lib/cranium/test_framework/database_entity.rb

Direct Known Subclasses

DatabaseSequence, DatabaseTable

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(entity, db_connection) ⇒ DatabaseEntity

Returns a new instance of DatabaseEntity.



8
9
10
# File 'lib/cranium/test_framework/database_entity.rb', line 8

def initialize(entity, db_connection)
  @entity_name, @connection = entity, db_connection
end

Instance Attribute Details

#connectionObject (readonly)

Returns the value of attribute connection.



4
5
6
# File 'lib/cranium/test_framework/database_entity.rb', line 4

def connection
  @connection
end

#entity_nameObject (readonly)

Returns the value of attribute entity_name.



3
4
5
# File 'lib/cranium/test_framework/database_entity.rb', line 3

def entity_name
  @entity_name
end

Class Method Details

.cleanupObject



22
23
24
25
# File 'lib/cranium/test_framework/database_entity.rb', line 22

def cleanup
  entities_created.each { |entity| entity.destroy }
  @entities_created = []
end

.entities_createdObject



16
17
18
# File 'lib/cranium/test_framework/database_entity.rb', line 16

def entities_created
  @entities_created ||= []
end