Class: DatabaseCleaner::Spec::DatabaseHelper
- Inherits:
-
Struct
- Object
- Struct
- DatabaseCleaner::Spec::DatabaseHelper
- Defined in:
- lib/database_cleaner/spec/database_helper.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
readonly
Returns the value of attribute connection.
-
#db ⇒ Object
Returns the value of attribute db.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#connection ⇒ Object (readonly)
Returns the value of attribute connection.
18 19 20 |
# File 'lib/database_cleaner/spec/database_helper.rb', line 18 def connection @connection end |
#db ⇒ Object
Returns the value of attribute db
5 6 7 |
# File 'lib/database_cleaner/spec/database_helper.rb', line 5 def db @db end |
Class Method Details
.with_all_dbs(&block) ⇒ Object
6 7 8 9 10 |
# File 'lib/database_cleaner/spec/database_helper.rb', line 6 def self.with_all_dbs &block %w[mysql2 sqlite3 postgres].map(&:to_sym).each do |db| yield new(db) end end |
Instance Method Details
#setup ⇒ Object
12 13 14 15 16 |
# File 'lib/database_cleaner/spec/database_helper.rb', line 12 def setup create_db establish_connection load_schema end |
#teardown ⇒ Object
20 21 22 |
# File 'lib/database_cleaner/spec/database_helper.rb', line 20 def teardown drop_db end |