Class: TestData::VerifiesDumpsAreLoadable
- Inherits:
-
Object
- Object
- TestData::VerifiesDumpsAreLoadable
- Defined in:
- lib/test_data/verifies_dumps_are_loadable.rb
Instance Method Summary collapse
- #call(quiet: false) ⇒ Object
-
#initialize ⇒ VerifiesDumpsAreLoadable
constructor
A new instance of VerifiesDumpsAreLoadable.
Constructor Details
#initialize ⇒ VerifiesDumpsAreLoadable
Returns a new instance of VerifiesDumpsAreLoadable.
3 4 5 6 |
# File 'lib/test_data/verifies_dumps_are_loadable.rb', line 3 def initialize @config = TestData.config @detects_database_emptiness = DetectsDatabaseEmptiness.new end |
Instance Method Details
#call(quiet: false) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/test_data/verifies_dumps_are_loadable.rb', line 8 def call(quiet: false) schema_dump_looks_good = Pathname.new(@config.schema_dump_full_path).readable? if !quiet && !schema_dump_looks_good log.warn "Warning: Database schema dump '#{@config.schema_dump_path}' not readable" end data_dump_looks_good = Pathname.new(@config.data_dump_full_path).readable? if !quiet && !data_dump_looks_good log.warn "Warning: Database data dump '#{@config.data_dump_path}' not readable" end non_test_data_dump_looks_good = Pathname.new(@config.non_test_data_dump_full_path).readable? if !quiet && !non_test_data_dump_looks_good log.warn "Warning: Database non-test data dump '#{@config.non_test_data_dump_path}' not readable" end database_empty = @detects_database_emptiness.empty? unless quiet || database_empty log.warn "Warning: Database '#{@config.database_name}' is not empty" end [ schema_dump_looks_good, data_dump_looks_good, non_test_data_dump_looks_good, database_empty ].all? end |