Class: TestData::DetectsDatabaseEmptiness
- Inherits:
-
Object
- Object
- TestData::DetectsDatabaseEmptiness
- Defined in:
- lib/test_data/detects_database_emptiness.rb
Instance Method Summary collapse
- #empty? ⇒ Boolean
-
#initialize ⇒ DetectsDatabaseEmptiness
constructor
A new instance of DetectsDatabaseEmptiness.
Constructor Details
#initialize ⇒ DetectsDatabaseEmptiness
Returns a new instance of DetectsDatabaseEmptiness.
3 4 5 |
# File 'lib/test_data/detects_database_emptiness.rb', line 3 def initialize @config = TestData.config end |
Instance Method Details
#empty? ⇒ Boolean
7 8 9 10 11 12 13 14 15 |
# File 'lib/test_data/detects_database_emptiness.rb', line 7 def empty? result = ActiveRecord::Base.connection.execute <<~SQL select not exists ( select from information_schema.tables where table_name = 'ar_internal_metadata' ) as empty SQL result.first["empty"] end |